aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorDavid Clare <david@funsoft.com>2006-12-01 21:24:38 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-20 13:14:25 -0500
commitc2585d962572744271a7e254d48c747727441936 (patch)
tree7e0f674b208f67abc55c6d97c9c78ef685db5e95 /drivers/usb/serial
parente05998d50d0bf9de5409a178e2f9869c7d1ea83e (diff)
USB: Prevent the funsoft serial device from entering raw mode
Added a device specific ioctl function to prevent the disabling of canonical mode. EINVAL is returned for any TCSETSF ioctl that doesn't have ICANON set. This patch is for 2.6.17 or later kernels. When "hwinfo --modem" is executed it opens the funsoft USB serial device and disables canonical mode. The device is kept this way until hwininfo has finished probing any modems on a system. The funsoft device expects to be running in canonical mode. Switching the device to raw mode can cause incomplete data packets and device timeouts. Signed-off-by: David Clare <david@funsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/funsoft.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/usb/serial/funsoft.c b/drivers/usb/serial/funsoft.c
index 77b977206a8c..d3be9214c7c1 100644
--- a/drivers/usb/serial/funsoft.c
+++ b/drivers/usb/serial/funsoft.c
@@ -14,6 +14,9 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/usb.h> 15#include <linux/usb.h>
16#include <linux/usb/serial.h> 16#include <linux/usb/serial.h>
17#include <asm/uaccess.h>
18
19static int debug;
17 20
18static struct usb_device_id id_table [] = { 21static struct usb_device_id id_table [] = {
19 { USB_DEVICE(0x1404, 0xcddc) }, 22 { USB_DEVICE(0x1404, 0xcddc) },
@@ -21,6 +24,26 @@ static struct usb_device_id id_table [] = {
21}; 24};
22MODULE_DEVICE_TABLE(usb, id_table); 25MODULE_DEVICE_TABLE(usb, id_table);
23 26
27static int funsoft_ioctl(struct usb_serial_port *port, struct file *file,
28 unsigned int cmd, unsigned long arg)
29{
30 struct termios t;
31
32 dbg("%s - port %d, cmd 0x%04x", __FUNCTION__, port->number, cmd);
33
34 if (cmd == TCSETSF) {
35 if (user_termios_to_kernel_termios(&t, (void __user *)arg))
36 return -EFAULT;
37
38 dbg("%s - iflag:%x oflag:%x cflag:%x lflag:%x", __FUNCTION__,
39 t.c_iflag, t.c_oflag, t.c_cflag, t.c_lflag);
40
41 if (!(t.c_lflag & ICANON))
42 return -EINVAL;
43 }
44 return -ENOIOCTLCMD;
45}
46
24static struct usb_driver funsoft_driver = { 47static struct usb_driver funsoft_driver = {
25 .name = "funsoft", 48 .name = "funsoft",
26 .probe = usb_serial_probe, 49 .probe = usb_serial_probe,
@@ -39,6 +62,7 @@ static struct usb_serial_driver funsoft_device = {
39 .num_bulk_in = NUM_DONT_CARE, 62 .num_bulk_in = NUM_DONT_CARE,
40 .num_bulk_out = NUM_DONT_CARE, 63 .num_bulk_out = NUM_DONT_CARE,
41 .num_ports = 1, 64 .num_ports = 1,
65 .ioctl = funsoft_ioctl,
42}; 66};
43 67
44static int __init funsoft_init(void) 68static int __init funsoft_init(void)
@@ -63,3 +87,6 @@ static void __exit funsoft_exit(void)
63module_init(funsoft_init); 87module_init(funsoft_init);
64module_exit(funsoft_exit); 88module_exit(funsoft_exit);
65MODULE_LICENSE("GPL"); 89MODULE_LICENSE("GPL");
90
91module_param(debug, bool, S_IRUGO | S_IWUSR);
92MODULE_PARM_DESC(debug, "Debug enabled or not");