From: Ian Abbott Date: Wed, 8 Mar 2017 16:03:01 +0000 (+0000) Subject: USB: serial: ftdi_sio: allow other bases for "event_char" X-Git-Tag: v4.12-rc1~97^2~9^2~56 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=f1ce25f292e7ef7a86e44ec4d30a7e179d3ddce0;p=linux.git USB: serial: ftdi_sio: allow other bases for "event_char" The 'store' function for the "event_char" device attribute currently expects a base 10 value. The value is composed of an enable bit in bit 8 and an 8-bit "event character" code in bits 7 to 0. It seems reasonable to allow hexadecimal and octal numbers to be written to the device attribute in addition to decimal. Make it so. Change the debug message to show the value in hexadecimal, rather than decimal. Signed-off-by: Ian Abbott Signed-off-by: Johan Hovold --- diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 4032a675643c..546171289869 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -1741,10 +1741,10 @@ static ssize_t store_event_char(struct device *dev, unsigned int v; int rv; - if (kstrtouint(valbuf, 10, &v) || v >= 0x200) + if (kstrtouint(valbuf, 0, &v) || v >= 0x200) return -EINVAL; - dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v); + dev_dbg(&port->dev, "%s: setting event char = 0x%03x\n", __func__, v); rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),