aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ipaq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ipaq.c')
-rw-r--r--drivers/usb/serial/ipaq.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index dbcfe172a5cc..9840bade79f9 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
71static __u16 product, vendor; 71static __u16 product, vendor;
72static int debug; 72static int debug;
73static int connect_retries = KP_RETRIES;
74static int initial_wait;
73 75
74/* Function prototypes for an ipaq */ 76/* Function prototypes for an ipaq */
75static int ipaq_open (struct usb_serial_port *port, struct file *filp); 77static int ipaq_open (struct usb_serial_port *port, struct file *filp);
@@ -248,6 +250,9 @@ static struct usb_device_id ipaq_id_table [] = {
248 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */ 250 { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */
249 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */ 251 { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
250 { 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 */
251 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */ 256 { USB_DEVICE(0x04E8, 0x5F00) }, /* Samsung NEXiO USB Sync */
252 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */ 257 { USB_DEVICE(0x04E8, 0x5F01) }, /* Samsung NEXiO USB Sync */
253 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */ 258 { USB_DEVICE(0x04E8, 0x5F02) }, /* Samsung NEXiO USB Sync */
@@ -582,7 +587,7 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
582 struct ipaq_private *priv; 587 struct ipaq_private *priv;
583 struct ipaq_packet *pkt; 588 struct ipaq_packet *pkt;
584 int i, result = 0; 589 int i, result = 0;
585 int retries = KP_RETRIES; 590 int retries = connect_retries;
586 591
587 dbg("%s - port %d", __FUNCTION__, port->number); 592 dbg("%s - port %d", __FUNCTION__, port->number);
588 593
@@ -646,16 +651,12 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
646 port->read_urb->transfer_buffer_length = URBDATA_SIZE; 651 port->read_urb->transfer_buffer_length = URBDATA_SIZE;
647 port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; 652 port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
648 653
654 msleep(1000*initial_wait);
649 /* Start reading from the device */ 655 /* Start reading from the device */
650 usb_fill_bulk_urb(port->read_urb, serial->dev, 656 usb_fill_bulk_urb(port->read_urb, serial->dev,
651 usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), 657 usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
652 port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, 658 port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
653 ipaq_read_bulk_callback, port); 659 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 660
660 /* 661 /*
661 * Send out control message observed in win98 sniffs. Not sure what 662 * Send out control message observed in win98 sniffs. Not sure what
@@ -670,8 +671,14 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
670 usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, 671 usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
671 0x1, 0, NULL, 0, 100); 672 0x1, 0, NULL, 0, 100);
672 if (result == 0) { 673 if (result == 0) {
674 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
675 if (result) {
676 err("%s - failed submitting read urb, error %d", __FUNCTION__, result);
677 goto error;
678 }
673 return 0; 679 return 0;
674 } 680 }
681 msleep(1000);
675 } 682 }
676 err("%s - failed doing control urb, error %d", __FUNCTION__, result); 683 err("%s - failed doing control urb, error %d", __FUNCTION__, result);
677 goto error; 684 goto error;
@@ -854,6 +861,7 @@ static void ipaq_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
854 861
855 if (urb->status) { 862 if (urb->status) {
856 dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); 863 dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status);
864 return;
857 } 865 }
858 866
859 spin_lock_irqsave(&write_list_lock, flags); 867 spin_lock_irqsave(&write_list_lock, flags);
@@ -966,3 +974,9 @@ MODULE_PARM_DESC(vendor, "User specified USB idVendor");
966 974
967module_param(product, ushort, 0); 975module_param(product, ushort, 0);
968MODULE_PARM_DESC(product, "User specified USB idProduct"); 976MODULE_PARM_DESC(product, "User specified USB idProduct");
977
978module_param(connect_retries, int, S_IRUGO|S_IWUSR);
979MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (one second each)");
980
981module_param(initial_wait, int, S_IRUGO|S_IWUSR);
982MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)");