diff options
Diffstat (limited to 'drivers/usb/serial/ipaq.c')
-rw-r--r-- | drivers/usb/serial/ipaq.c | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index 9da6d2a8f2b0..cbc725a6c58e 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -44,7 +44,6 @@ | |||
44 | * Thanks to info from Heath Robinson and Arieh Davidoff. | 44 | * Thanks to info from Heath Robinson and Arieh Davidoff. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #include <linux/config.h> | ||
48 | #include <linux/kernel.h> | 47 | #include <linux/kernel.h> |
49 | #include <linux/errno.h> | 48 | #include <linux/errno.h> |
50 | #include <linux/init.h> | 49 | #include <linux/init.h> |
@@ -56,7 +55,7 @@ | |||
56 | #include <linux/spinlock.h> | 55 | #include <linux/spinlock.h> |
57 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
58 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
59 | #include "usb-serial.h" | 58 | #include <linux/usb/serial.h> |
60 | #include "ipaq.h" | 59 | #include "ipaq.h" |
61 | 60 | ||
62 | #define KP_RETRIES 100 | 61 | #define KP_RETRIES 100 |
@@ -71,6 +70,8 @@ | |||
71 | 70 | ||
72 | static __u16 product, vendor; | 71 | static __u16 product, vendor; |
73 | static int debug; | 72 | static int debug; |
73 | static int connect_retries = KP_RETRIES; | ||
74 | static int initial_wait; | ||
74 | 75 | ||
75 | /* Function prototypes for an ipaq */ | 76 | /* Function prototypes for an ipaq */ |
76 | static int ipaq_open (struct usb_serial_port *port, struct file *filp); | 77 | static int ipaq_open (struct usb_serial_port *port, struct file *filp); |
@@ -249,6 +250,9 @@ static struct usb_device_id ipaq_id_table [] = { | |||
249 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ | 250 | { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ |
250 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ | 251 | { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ |
251 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ | 252 | { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */ |
253 | { USB_DEVICE(0x04DD, 0x9102) }, /* SHARP WS003SH USB Modem */ | ||
254 | { USB_DEVICE(0x04DD, 0x9121) }, /* SHARP WS004SH USB Modem */ | ||
255 | { USB_DEVICE(0x04DD, 0x9123) }, /* SHARP WS007SH USB Modem */ | ||
252 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ | 256 | { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ |
253 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ | 257 | { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ |
254 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ | 258 | { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ |
@@ -475,6 +479,7 @@ static struct usb_device_id ipaq_id_table [] = { | |||
475 | { USB_DEVICE(0x0BB4, 0x0A9D) }, /* SmartPhone USB Sync */ | 479 | { USB_DEVICE(0x0BB4, 0x0A9D) }, /* SmartPhone USB Sync */ |
476 | { USB_DEVICE(0x0BB4, 0x0A9E) }, /* SmartPhone USB Sync */ | 480 | { USB_DEVICE(0x0BB4, 0x0A9E) }, /* SmartPhone USB Sync */ |
477 | { USB_DEVICE(0x0BB4, 0x0A9F) }, /* SmartPhone USB Sync */ | 481 | { USB_DEVICE(0x0BB4, 0x0A9F) }, /* SmartPhone USB Sync */ |
482 | { USB_DEVICE(0x0BB4, 0x0BCE) }, /* "High Tech Computer Corp" */ | ||
478 | { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */ | 483 | { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */ |
479 | { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */ | 484 | { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */ |
480 | { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */ | 485 | { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */ |
@@ -583,7 +588,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
583 | struct ipaq_private *priv; | 588 | struct ipaq_private *priv; |
584 | struct ipaq_packet *pkt; | 589 | struct ipaq_packet *pkt; |
585 | int i, result = 0; | 590 | int i, result = 0; |
586 | int retries = KP_RETRIES; | 591 | int retries = connect_retries; |
587 | 592 | ||
588 | dbg("%s - port %d", __FUNCTION__, port->number); | 593 | dbg("%s - port %d", __FUNCTION__, port->number); |
589 | 594 | ||
@@ -647,16 +652,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
647 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; | 652 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; |
648 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; | 653 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; |
649 | 654 | ||
650 | /* Start reading from the device */ | 655 | msleep(1000*initial_wait); |
651 | usb_fill_bulk_urb(port->read_urb, serial->dev, | ||
652 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), | ||
653 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, | ||
654 | ipaq_read_bulk_callback, port); | ||
655 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
656 | if (result) { | ||
657 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
658 | goto error; | ||
659 | } | ||
660 | 656 | ||
661 | /* | 657 | /* |
662 | * Send out control message observed in win98 sniffs. Not sure what | 658 | * Send out control message observed in win98 sniffs. Not sure what |
@@ -670,12 +666,31 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
670 | result = usb_control_msg(serial->dev, | 666 | result = usb_control_msg(serial->dev, |
671 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, | 667 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, |
672 | 0x1, 0, NULL, 0, 100); | 668 | 0x1, 0, NULL, 0, 100); |
673 | if (result == 0) { | 669 | if (!result) |
674 | return 0; | 670 | break; |
675 | } | 671 | |
672 | msleep(1000); | ||
676 | } | 673 | } |
677 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); | 674 | |
678 | goto error; | 675 | if (!retries && result) { |
676 | err("%s - failed doing control urb, error %d", __FUNCTION__, | ||
677 | result); | ||
678 | goto error; | ||
679 | } | ||
680 | |||
681 | /* Start reading from the device */ | ||
682 | usb_fill_bulk_urb(port->read_urb, serial->dev, | ||
683 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), | ||
684 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, | ||
685 | ipaq_read_bulk_callback, port); | ||
686 | |||
687 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
688 | if (result) { | ||
689 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
690 | goto error; | ||
691 | } | ||
692 | |||
693 | return 0; | ||
679 | 694 | ||
680 | enomem: | 695 | enomem: |
681 | result = -ENOMEM; | 696 | result = -ENOMEM; |
@@ -855,6 +870,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
855 | 870 | ||
856 | if (urb->status) { | 871 | if (urb->status) { |
857 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 872 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
873 | return; | ||
858 | } | 874 | } |
859 | 875 | ||
860 | spin_lock_irqsave(&write_list_lock, flags); | 876 | spin_lock_irqsave(&write_list_lock, flags); |
@@ -967,3 +983,9 @@ MODULE_PARM_DESC(vendor, "User specified USB idVendor"); | |||
967 | 983 | ||
968 | module_param(product, ushort, 0); | 984 | module_param(product, ushort, 0); |
969 | MODULE_PARM_DESC(product, "User specified USB idProduct"); | 985 | MODULE_PARM_DESC(product, "User specified USB idProduct"); |
986 | |||
987 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); | ||
988 | MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (one second each)"); | ||
989 | |||
990 | module_param(initial_wait, int, S_IRUGO|S_IWUSR); | ||
991 | MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)"); | ||