diff options
Diffstat (limited to 'drivers/usb/serial/ipaq.c')
-rw-r--r-- | drivers/usb/serial/ipaq.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index dbcfe172a5cc..59c5d999009a 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -55,7 +55,7 @@ | |||
55 | #include <linux/spinlock.h> | 55 | #include <linux/spinlock.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | #include "usb-serial.h" | 58 | #include <linux/usb/serial.h> |
59 | #include "ipaq.h" | 59 | #include "ipaq.h" |
60 | 60 | ||
61 | #define KP_RETRIES 100 | 61 | #define KP_RETRIES 100 |
@@ -70,6 +70,8 @@ | |||
70 | 70 | ||
71 | static __u16 product, vendor; | 71 | static __u16 product, vendor; |
72 | static int debug; | 72 | static int debug; |
73 | static int connect_retries = KP_RETRIES; | ||
74 | static int initial_wait; | ||
73 | 75 | ||
74 | /* Function prototypes for an ipaq */ | 76 | /* Function prototypes for an ipaq */ |
75 | 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); |
@@ -582,7 +584,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
582 | struct ipaq_private *priv; | 584 | struct ipaq_private *priv; |
583 | struct ipaq_packet *pkt; | 585 | struct ipaq_packet *pkt; |
584 | int i, result = 0; | 586 | int i, result = 0; |
585 | int retries = KP_RETRIES; | 587 | int retries = connect_retries; |
586 | 588 | ||
587 | dbg("%s - port %d", __FUNCTION__, port->number); | 589 | dbg("%s - port %d", __FUNCTION__, port->number); |
588 | 590 | ||
@@ -646,16 +648,12 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
646 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; | 648 | port->read_urb->transfer_buffer_length = URBDATA_SIZE; |
647 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; | 649 | port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; |
648 | 650 | ||
651 | msleep(1000*initial_wait); | ||
649 | /* Start reading from the device */ | 652 | /* Start reading from the device */ |
650 | usb_fill_bulk_urb(port->read_urb, serial->dev, | 653 | usb_fill_bulk_urb(port->read_urb, serial->dev, |
651 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), | 654 | usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), |
652 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, | 655 | port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, |
653 | ipaq_read_bulk_callback, port); | 656 | ipaq_read_bulk_callback, port); |
654 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
655 | if (result) { | ||
656 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
657 | goto error; | ||
658 | } | ||
659 | 657 | ||
660 | /* | 658 | /* |
661 | * Send out control message observed in win98 sniffs. Not sure what | 659 | * Send out control message observed in win98 sniffs. Not sure what |
@@ -670,8 +668,14 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp) | |||
670 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, | 668 | usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, |
671 | 0x1, 0, NULL, 0, 100); | 669 | 0x1, 0, NULL, 0, 100); |
672 | if (result == 0) { | 670 | if (result == 0) { |
671 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | ||
672 | if (result) { | ||
673 | err("%s - failed submitting read urb, error %d", __FUNCTION__, result); | ||
674 | goto error; | ||
675 | } | ||
673 | return 0; | 676 | return 0; |
674 | } | 677 | } |
678 | msleep(1000); | ||
675 | } | 679 | } |
676 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); | 680 | err("%s - failed doing control urb, error %d", __FUNCTION__, result); |
677 | goto error; | 681 | goto error; |
@@ -854,6 +858,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | |||
854 | 858 | ||
855 | if (urb->status) { | 859 | if (urb->status) { |
856 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); | 860 | dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); |
861 | return; | ||
857 | } | 862 | } |
858 | 863 | ||
859 | spin_lock_irqsave(&write_list_lock, flags); | 864 | spin_lock_irqsave(&write_list_lock, flags); |
@@ -966,3 +971,9 @@ MODULE_PARM_DESC(vendor, "User specified USB idVendor"); | |||
966 | 971 | ||
967 | module_param(product, ushort, 0); | 972 | module_param(product, ushort, 0); |
968 | MODULE_PARM_DESC(product, "User specified USB idProduct"); | 973 | MODULE_PARM_DESC(product, "User specified USB idProduct"); |
974 | |||
975 | module_param(connect_retries, int, S_IRUGO|S_IWUSR); | ||
976 | MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (one second each)"); | ||
977 | |||
978 | module_param(initial_wait, int, S_IRUGO|S_IWUSR); | ||
979 | MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)"); | ||