[PATCH v2 5/5] USB: serial: ftdi_sio: allow other bases for "event_char"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <abbotti@xxxxxxxxx>
---
v2:
- This was patch 6 in the original patch series.
- As suggested by Johan Hovold, change the debug log message to show
the value written in hexadecimal instead of decimal.
---
 drivers/usb/serial/ftdi_sio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 0f3f7bfe9294..ee5136baea71 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -1740,10 +1740,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),
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux