Bug 10118

Summary: visor: probe of 1-2.3:1.0 failed with error -5
Product: Drivers Reporter: Akkana Peck (akkzilla)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: RESOLVED CODE_FIX    
Severity: normal CC: cdhowie, nhorman, thomas.constans
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.24.3 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: .config for the desktop machine

Description Akkana Peck 2008-02-26 17:15:28 UTC
Latest working kernel version: 2.6.23.12
Earliest failing kernel version: 2.6.24-rc5
Distribution: Ubuntu gutsy
Hardware Environment: AMD 64 desktop or Sony Vaio SR71 laptop
Software Environment: pilot-link
Problem Description:

As of 2.6.24, I can no longer sync my Treo 90 (PalmOS PDA using the visor driver).
It works in 2.6.23.12, but failed starting with 2.6.24-rc5 and still fails in 2.6.24.3. (It also leaves the Treo in an unstable state requiring a reset, but that's probably a Treo problem.)

/var/log/messages from an attempt at connecting:
Feb 26 16:50:36 clavius kernel: [  111.932644] usb 1-2.3: new full speed USB device using ehci_hcd and address 4
Feb 26 16:50:36 clavius kernel: [  112.041076] usb 1-2.3: configuration #1 chosen from 1 choice
Feb 26 16:50:37 clavius kernel: [  112.041618] visor: probe of 1-2.3:1.0 failed with error -5
Feb 26 16:50:55 clavius kernel: [  130.875451] usb 1-2.3: USB disconnect, address 4

visor is built in to the kernel, not loaded as a module, if that matters.

Steps to reproduce:
Connect visor cable to host USB.
Press hotsync button.
On host, type: pilot-xfer -l
Observe that nothing happens.
Comment 1 Akkana Peck 2008-02-26 17:23:10 UTC
Created attachment 15020 [details]
.config for the desktop machine
Comment 2 Anonymous Emailer 2008-02-26 19:02:15 UTC
Reply-To: akpm@linux-foundation.org


(please respond via emailed reply-to-all, not via the bugzilla web interface)

On Tue, 26 Feb 2008 17:15:29 -0800 (PST) bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=10118
> 
>            Summary: visor: probe of 1-2.3:1.0 failed with error -5
>            Product: Drivers
>            Version: 2.5
>      KernelVersion: 2.6.24.3
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: USB
>         AssignedTo: greg@kroah.com
>         ReportedBy: akkzilla@shallowsky.com
> 
> 
> Latest working kernel version: 2.6.23.12
> Earliest failing kernel version: 2.6.24-rc5
> Distribution: Ubuntu gutsy
> Hardware Environment: AMD 64 desktop or Sony Vaio SR71 laptop
> Software Environment: pilot-link
> Problem Description:
> 
> As of 2.6.24, I can no longer sync my Treo 90 (PalmOS PDA using the visor
> driver).
> It works in 2.6.23.12, but failed starting with 2.6.24-rc5 and still fails in
> 2.6.24.3. (It also leaves the Treo in an unstable state requiring a reset,
> but
> that's probably a Treo problem.)
> 
> /var/log/messages from an attempt at connecting:
> Feb 26 16:50:36 clavius kernel: [  111.932644] usb 1-2.3: new full speed USB
> device using ehci_hcd and address 4
> Feb 26 16:50:36 clavius kernel: [  112.041076] usb 1-2.3: configuration #1
> chosen from 1 choice
> Feb 26 16:50:37 clavius kernel: [  112.041618] visor: probe of 1-2.3:1.0
> failed
> with error -5
> Feb 26 16:50:55 clavius kernel: [  130.875451] usb 1-2.3: USB disconnect,
> address 4
> 
> visor is built in to the kernel, not loaded as a module, if that matters.
> 
> Steps to reproduce:
> Connect visor cable to host USB.
> Press hotsync button.
> On host, type: pilot-xfer -l
> Observe that nothing happens.
> 

The only change to visor between 2.6.23 and 2.6.24 was "USB: visor: termios
bits".  Please apply the below revert patch to 2.6.24.x and let us know if
that fixes it?

Probably it won't, and we broke something in USB core :(

Thanks.




Revert

  commit d9c563626d9a136636385209d59d0c4f16c4a7ab
  Author: Alan Cox <alan@lxorguk.ukuu.org.uk>
  Date:   Wed Sep 26 23:34:18 2007 +0100

    USB: visor: termios bits
    
    Visor has a huge complex routine which displays termios bits for debug
    but doesn't do anything. Get the correct behaviour by removing it all
    
    Signed-off-by: Alan Cox <alan@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Cc: <akkzilla@shallowsky.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/usb/serial/visor.c |   64 +++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff -puN drivers/usb/serial/visor.c~revert-1 drivers/usb/serial/visor.c
--- a/drivers/usb/serial/visor.c~revert-1
+++ a/drivers/usb/serial/visor.c
@@ -46,6 +46,7 @@ static int  visor_probe		(struct usb_ser
 static int  visor_calc_num_ports(struct usb_serial *serial);
 static void visor_shutdown	(struct usb_serial *serial);
 static int  visor_ioctl		(struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
+static void visor_set_termios	(struct usb_serial_port *port, struct ktermios *old_termios);
 static void visor_write_bulk_callback	(struct urb *urb);
 static void visor_read_bulk_callback	(struct urb *urb);
 static void visor_read_int_callback	(struct urb *urb);
@@ -202,6 +203,7 @@ static struct usb_serial_driver handspri
 	.calc_num_ports =	visor_calc_num_ports,
 	.shutdown =		visor_shutdown,
 	.ioctl =		visor_ioctl,
+	.set_termios =		visor_set_termios,
 	.write =		visor_write,
 	.write_room =		visor_write_room,
 	.chars_in_buffer =	visor_chars_in_buffer,
@@ -232,6 +234,7 @@ static struct usb_serial_driver clie_5_d
 	.calc_num_ports =	visor_calc_num_ports,
 	.shutdown =		visor_shutdown,
 	.ioctl =		visor_ioctl,
+	.set_termios =		visor_set_termios,
 	.write =		visor_write,
 	.write_room =		visor_write_room,
 	.chars_in_buffer =	visor_chars_in_buffer,
@@ -259,6 +262,7 @@ static struct usb_serial_driver clie_3_5
 	.unthrottle =		visor_unthrottle,
 	.attach =		clie_3_5_startup,
 	.ioctl =		visor_ioctl,
+	.set_termios =		visor_set_termios,
 	.write =		visor_write,
 	.write_room =		visor_write_room,
 	.chars_in_buffer =	visor_chars_in_buffer,
@@ -936,6 +940,66 @@ static int visor_ioctl (struct usb_seria
 	return -ENOIOCTLCMD;
 }
 
+
+/* This function is all nice and good, but we don't change anything based on it :) */
+static void visor_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
+{
+	unsigned int cflag;
+
+	dbg("%s - port %d", __FUNCTION__, port->number);
+
+	if ((!port->tty) || (!port->tty->termios)) {
+		dbg("%s - no tty structures", __FUNCTION__);
+		return;
+	}
+
+	cflag = port->tty->termios->c_cflag;
+
+	/* get the byte size */
+	switch (cflag & CSIZE) {
+		case CS5:	dbg("%s - data bits = 5", __FUNCTION__);   break;
+		case CS6:	dbg("%s - data bits = 6", __FUNCTION__);   break;
+		case CS7:	dbg("%s - data bits = 7", __FUNCTION__);   break;
+		default:
+		case CS8:	dbg("%s - data bits = 8", __FUNCTION__);   break;
+	}
+	
+	/* determine the parity */
+	if (cflag & PARENB)
+		if (cflag & PARODD)
+			dbg("%s - parity = odd", __FUNCTION__);
+		else
+			dbg("%s - parity = even", __FUNCTION__);
+	else
+		dbg("%s - parity = none", __FUNCTION__);
+
+	/* figure out the stop bits requested */
+	if (cflag & CSTOPB)
+		dbg("%s - stop bits = 2", __FUNCTION__);
+	else
+		dbg("%s - stop bits = 1", __FUNCTION__);
+
+	
+	/* figure out the flow control settings */
+	if (cflag & CRTSCTS)
+		dbg("%s - RTS/CTS is enabled", __FUNCTION__);
+	else
+		dbg("%s - RTS/CTS is disabled", __FUNCTION__);
+	
+	/* determine software flow control */
+	if (I_IXOFF(port->tty))
+		dbg("%s - XON/XOFF is enabled, XON = %2x, XOFF = %2x",
+		    __FUNCTION__, START_CHAR(port->tty), STOP_CHAR(port->tty));
+	else
+		dbg("%s - XON/XOFF is disabled", __FUNCTION__);
+
+	/* get the baud rate wanted */
+	dbg("%s - baud rate = %d", __FUNCTION__, tty_get_baud_rate(port->tty));
+
+	return;
+}
+
+
 static int __init visor_init (void)
 {
 	int i, retval;
_
Comment 3 Anonymous Emailer 2008-02-26 19:31:32 UTC
Reply-To: akkana@shallowsky.com

Andrew Morton writes:
> The only change to visor between 2.6.23 and 2.6.24 was "USB: visor: termios
> bits".  Please apply the below revert patch to 2.6.24.x and let us know if
> that fixes it?
> 
> Probably it won't, and we broke something in USB core :(

Alas, no, the patch doesn't fix it.

I tried 2.6.25-rc3 too -- fails with the same error as .24.3.

	...Akkana
Comment 4 Neil Horman 2008-03-13 13:47:27 UTC
I think I'm seeing the same thing.  Somewhere right before 2.6.24 released  I stopped being able to sync my treo 750p.  In trying to track it down I started watching udev events when I plugged in the device.  I noticed that I was getting all the usual add event for the generic usb endpoints that I would expect, but I never saw a add event for /dev/ttyUSB<n> (which I did on sufficiently old kernels), so my udev rules never match and I never get a device created that kpilot can communicate with.  I'm not well versed enough in the usb code (or perhaps this is part of sysfs) to know where or by what mechanism those events are generated, but my guess is wherever happens is where the bug was introduced.
Comment 5 juan-manuel hernández-sánchez 2008-04-01 23:37:40 UTC
Same here.

kernel26 2.6.24.4-1
Arch Linux
Dual Core
Sony Clié TJ25

drivers/usb/serial/usb-serial.c: USB Serial support registered for Handspring Visor / Palm OS
visor: probe of 4-2:1.0 failed with error -5
usbcore: registered new interface driver visor
drivers/usb/serial/visor.c: USB HandSpring Visor / Palm OS driver
visor: probe of 4-2:1.0 failed with error -5
Comment 6 Thomas Constans 2008-04-03 05:06:37 UTC
I also experience this problem:

kernel is stock 2.6.24 from Debian Sid

palm i a Garmin ique3600

i use to be able to sync with kernel 2.6.18 from debian stable.

i get the following syslog when pushing the hotsync button:
 Apr  3 12:32:13 workine kernel: usb 1-2: new full speed USB device using uhci_hcd and address 5
Apr  3 12:32:13 workine kernel: usb 1-2: configuration #1 chosen from 1 choice


i have to manually load visor module to get the device recgnized:

Apr  3 12:32:25 workine kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
Apr  3 12:32:25 workine kernel: usbcore: registered new interface driver usbserial_generic
Apr  3 12:32:25 workine kernel: drivers/usb/serial/usb-serial.c: USB Serial Driver core
Apr  3 12:32:25 workine kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for Handspring Visor / Palm OS
Apr  3 12:32:25 workine kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for Sony Clie 3.5
Apr  3 12:32:25 workine kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for Sony Clie 5.0
Apr  3 12:32:25 workine kernel: visor: probe of 1-2:1.0 failed with error -5

Regards
Comment 7 Akkana Peck 2008-04-30 16:32:37 UTC
Good news: this problem appears to be fixed in 2.6.25. Here's hoping it works for everyone else as well.
Comment 8 Thomas Constans 2008-05-01 03:31:25 UTC
I confirm this,

It now works with stock 2.6.25 debian kernel.

I still have to manually load visor module to get my device files.

And i now have problems with gnome-pilot, but this is an other story...

Regards
Comment 9 Neil Horman 2008-05-01 04:31:25 UTC
ACK, I'm hapily syncing my treo.  This can be closed, thanks all!