public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Gevaerts <frank.gevaerts@fks.be>
To: linux-kernel@vger.kernel.org
Cc: Greg KH <gregkh@suse.de>, Pete Zaitcev <zaitcev@redhat.com>,
	lcapitulino@mandriva.com.br,
	linux-usb-devel@lists.sourceforge.net
Subject: [PATCH] ipaq.c connection open timing parameters
Date: Wed, 14 Jun 2006 14:05:52 +0200	[thread overview]
Message-ID: <20060614120551.GC20751@fks.be> (raw)
In-Reply-To: <20060614115822.GB20751@fks.be>

Adds configurable waiting periods to the ipaq connection code. These are
not needed when the pocketpc device is running normally when plugged in,
but they need extra delays if they are physically connected while
rebooting.
There are two parameters :
* initial_wait : this is the delay before the driver attemts to start the
  connection. This is needed because the pocktpc device takes much
  longer to boot if the driver starts sending control packets too soon.
* connect_retries : this is the number of times the control urb is
  retried before finally giving up. The patch also adds a 1 second delay
  between retries.
I'm not sure if the cases where this patch is useful are general enough
to include this in the kernel.

Signed-off-by: Frank Gevaerts <frank.gevaerts@fks.be>

diff -urp linux-2.6.17-rc6.a/drivers/usb/serial/ipaq.c linux-2.6.17-rc6.b/drivers/usb/serial/ipaq.c
--- linux-2.6.17-rc6.a/drivers/usb/serial/ipaq.c	2006-06-14 13:22:57.000000000 +0200
+++ linux-2.6.17-rc6.b/drivers/usb/serial/ipaq.c	2006-06-14 13:29:40.000000000 +0200
@@ -71,6 +71,8 @@
 
 static __u16 product, vendor;
 static int debug;
+static int connect_retries = KP_RETRIES;
+static int initial_wait;
 
 /* Function prototypes for an ipaq */
 static int  ipaq_open (struct usb_serial_port *port, struct file *filp);
@@ -583,7 +585,7 @@ static int ipaq_open(struct usb_serial_p
 	struct ipaq_private	*priv;
 	struct ipaq_packet	*pkt;
 	int			i, result = 0;
-	int			retries = KP_RETRIES;
+	int			retries = connect_retries;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -647,6 +649,7 @@ static int ipaq_open(struct usb_serial_p
 	port->read_urb->transfer_buffer_length = URBDATA_SIZE;
 	port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE;
 	
+	msleep(1000*initial_wait);
 	/* Start reading from the device */
 	usb_fill_bulk_urb(port->read_urb, serial->dev, 
 		      usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
@@ -673,6 +676,7 @@ static int ipaq_open(struct usb_serial_p
 			result = usb_submit_urb(port->read_urb, GFP_KERNEL);
 			return 0;
 		}
+		msleep(1000);
 	}
 	err("%s - failed doing control urb, error %d", __FUNCTION__, result);
 	goto error;
@@ -968,3 +972,9 @@ MODULE_PARM_DESC(vendor, "User specified
 
 module_param(product, ushort, 0);
 MODULE_PARM_DESC(product, "User specified USB idProduct");
+
+module_param(connect_retries, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(connect_retries, "Maximum number of connect retries (1 second each)");
+
+module_param(initial_wait, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(initial_wait, "Time to wait before attempting a connection (in seconds)");

-- 
Frank Gevaerts                                 frank.gevaerts@fks.be
fks bvba - Formal and Knowledge Systems        http://www.fks.be/
Stationsstraat 108                             Tel:  ++32-(0)11-21 49 11
B-3570 ALKEN                                   Fax:  ++32-(0)11-22 04 19

  reply	other threads:[~2006-06-14 12:06 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 18:22 usb-serial ipaq kernel problem Frank Gevaerts
2006-05-26 20:34 ` Pete Zaitcev
2006-05-26 21:12   ` Frank Gevaerts
2006-05-27 11:41   ` Frank Gevaerts
2006-05-29 15:01   ` Luiz Fernando N. Capitulino
2006-05-29 16:25     ` Luiz Fernando N. Capitulino
2006-05-29 17:11       ` Luiz Fernando N. Capitulino
2006-05-29 19:43         ` Frank Gevaerts
2006-05-29 20:24           ` Luiz Fernando N. Capitulino
2006-05-29 20:47             ` Frank Gevaerts
2006-05-29 22:33               ` Luiz Fernando N. Capitulino
2006-05-30  8:21                 ` Frank Gevaerts
2006-05-30 14:38                   ` Luiz Fernando N. Capitulino
2006-05-30 14:53                     ` Luiz Fernando N. Capitulino
2006-05-30 15:09                       ` Frank Gevaerts
2006-05-30 17:48                       ` Frank Gevaerts
2006-05-30 18:33                         ` Pete Zaitcev
2006-05-30 19:04                           ` Frank Gevaerts
2006-05-30 20:53                           ` Luiz Fernando N. Capitulino
2006-05-31 21:38                           ` Frank Gevaerts
2006-05-31 21:55                             ` Greg KH
2006-05-31 22:42                               ` [PATCH] ipaq.c bugfixes Frank Gevaerts
2006-05-31 22:46                                 ` Greg KH
2006-06-01 19:18                                   ` Frank Gevaerts
2006-06-14 11:58                                     ` Frank Gevaerts
2006-06-14 12:05                                       ` Frank Gevaerts [this message]
2006-06-14 14:21                                         ` [PATCH] ipaq.c connection open timing parameters Frank Gevaerts
2006-06-14 13:58                                       ` [PATCH] ipaq.c bugfixes Luiz Fernando N. Capitulino
2006-06-14 14:18                                         ` Frank Gevaerts
2006-06-01 19:16                                 ` Frank Gevaerts
2006-06-02 12:59                                   ` [linux-usb-devel] " Luiz Fernando N. Capitulino
2006-06-02 13:10                                     ` Frank Gevaerts
2006-05-30 20:52                         ` usb-serial ipaq kernel problem Luiz Fernando N. Capitulino
2006-05-30 21:36                           ` Frank Gevaerts
2006-05-31 21:10                             ` Luiz Fernando N. Capitulino
2006-05-31 21:23                               ` Frank Gevaerts
2006-05-30 15:06                     ` Frank Gevaerts
2006-05-30 15:56                       ` Luiz Fernando N. Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060614120551.GC20751@fks.be \
    --to=frank.gevaerts@fks.be \
    --cc=gregkh@suse.de \
    --cc=lcapitulino@mandriva.com.br \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox