Bug 14103

Summary: cdc_acm gives I/O error
Product: Drivers Reporter: Paul Martin (pm)
Component: USBAssignee: Greg Kroah-Hartman (greg)
Status: CLOSED CODE_FIX    
Severity: normal CC: bbjh1, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.31-rc8 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 13615    
Attachments: Output of "lsusb -v"
Tested patch from Oliver Neukum

Description Paul Martin 2009-09-01 13:30:16 UTC
usb 3-2: new full speed USB device using uhci_hcd and address 39
usb 3-2: New USB device found, idVendor=20df, idProduct=0001
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-2: Product: Entropy Key
usb 3-2: Manufacturer: Simtec Electronics
usb 3-2: SerialNumber: OQBuBlg0MTFBVxZD
usb 3-2: configuration #1 chosen from 1 choice
cdc_acm 3-2:1.0: This device cannot do calls on its own. It is not a modem.
cdc_acm 3-2:1.0: ttyACM0: USB ACM device

# cat /dev/ttyACM0
cat: /dev/ttyACM0: Input/output error

This device works in 2.6.30, but is broken in 2.6.31-rc1 and following.
Comment 1 Paul Martin 2009-09-01 13:35:54 UTC
Created attachment 22952 [details]
Output of "lsusb -v"
Comment 2 Andrew Morton 2009-09-03 21:59:33 UTC
(switched to email.  Please respond via emailed reply-to-all, not via the
bugzilla web interface).

On Tue, 1 Sep 2009 13:30:17 GMT
bugzilla-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=14103
> 
>            Summary: cdc_acm gives I/O error
>            Product: Drivers
>            Version: 2.5
>     Kernel Version: 2.6.31-rc8

A post-2.6.30 regression...

>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: USB
>         AssignedTo: greg@kroah.com
>         ReportedBy: pm@debian.org
>         Regression: Yes
> 
> 
> usb 3-2: new full speed USB device using uhci_hcd and address 39
> usb 3-2: New USB device found, idVendor=20df, idProduct=0001
> usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> usb 3-2: Product: Entropy Key
> usb 3-2: Manufacturer: Simtec Electronics
> usb 3-2: SerialNumber: OQBuBlg0MTFBVxZD
> usb 3-2: configuration #1 chosen from 1 choice
> cdc_acm 3-2:1.0: This device cannot do calls on its own. It is not a modem.
> cdc_acm 3-2:1.0: ttyACM0: USB ACM device
> 
> # cat /dev/ttyACM0
> cat: /dev/ttyACM0: Input/output error
> 
> This device works in 2.6.30, but is broken in 2.6.31-rc1 and following.
Comment 3 Anonymous Emailer 2009-09-04 10:57:27 UTC
Reply-To: oliver@neukum.org

Am Donnerstag, 3. September 2009 23:59:02 schrieb Andrew Morton:

> > usb 3-2: new full speed USB device using uhci_hcd and address 39
> > usb 3-2: New USB device found, idVendor=20df, idProduct=0001
> > usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> > usb 3-2: Product: Entropy Key
> > usb 3-2: Manufacturer: Simtec Electronics
> > usb 3-2: SerialNumber: OQBuBlg0MTFBVxZD
> > usb 3-2: configuration #1 chosen from 1 choice
> > cdc_acm 3-2:1.0: This device cannot do calls on its own. It is not a
> > modem. cdc_acm 3-2:1.0: ttyACM0: USB ACM device
> >
> > # cat /dev/ttyACM0
> > cat: /dev/ttyACM0: Input/output error
> >
> > This device works in 2.6.30, but is broken in 2.6.31-rc1 and following.

Please provide lsusb -v? Anything in the syslog? Please do an strace.
I'd like to know whether it errors in open or read.

	Regards
		Oliver
Comment 4 Paul Martin 2009-09-04 17:42:58 UTC
On Fri, Sep 04, 2009 at 12:58:40PM +0200, Oliver Neukum wrote:
> Am Donnerstag, 3. September 2009 23:59:02 schrieb Andrew Morton:
> 
> > > usb 3-2: new full speed USB device using uhci_hcd and address 39
> > > usb 3-2: New USB device found, idVendor=20df, idProduct=0001
> > > usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
> > > usb 3-2: Product: Entropy Key
> > > usb 3-2: Manufacturer: Simtec Electronics
> > > usb 3-2: SerialNumber: OQBuBlg0MTFBVxZD
> > > usb 3-2: configuration #1 chosen from 1 choice
> > > cdc_acm 3-2:1.0: This device cannot do calls on its own. It is not a
> > > modem. cdc_acm 3-2:1.0: ttyACM0: USB ACM device
> > >
> > > # cat /dev/ttyACM0
> > > cat: /dev/ttyACM0: Input/output error
> > >
> > > This device works in 2.6.30, but is broken in 2.6.31-rc1 and following.
> 
> Please provide lsusb -v? Anything in the syslog? Please do an strace.
> I'd like to know whether it errors in open or read.

It was attached to the original bug.

http://bugzilla.kernel.org/attachment.cgi?id=22952

From the strace:
..
open("/dev/ttyACM0", O_RDONLY|O_LARGEFILE) = -1 EIO (Input/output error)
..
Comment 5 Anonymous Emailer 2009-09-04 21:03:11 UTC
Reply-To: oliver@neukum.org

Am Freitag, 4. September 2009 19:42:47 schrieb Paul Martin:
> On Fri, Sep 04, 2009 at 12:58:40PM +0200, Oliver Neukum wrote:
> > Am Donnerstag, 3. September 2009 23:59:02 schrieb Andrew Morton:
> > > > # cat /dev/ttyACM0
> > > > cat: /dev/ttyACM0: Input/output error
> > > >
> > > > This device works in 2.6.30, but is broken in 2.6.31-rc1 and
> > > > following.
> >
> > Please provide lsusb -v? Anything in the syslog? Please do an strace.
> > I'd like to know whether it errors in open or read.
>
> It was attached to the original bug.
>
> http://bugzilla.kernel.org/attachment.cgi?id=22952
>
> From the strace:
> ..
> open("/dev/ttyACM0", O_RDONLY|O_LARGEFILE) = -1 EIO (Input/output error)
> ..

OK, please apply the included debugging patch, change "#undef DEBUG"
in cdc-acm.c to "#define DEBUG", recompile and post dmesg.

	Regards
		Oliver

--

commit e1b8b513bcba5313efa8b1637c5d9490a1944236
Author: Oliver Neukum <oliver@neukum.org>
Date:   Fri Sep 4 19:53:04 2009 +0200

    usb:cdc-acm: additional debugging output

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 2bfc41e..d4e6c05 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -610,6 +610,8 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
 
 	tasklet_schedule(&acm->urb_task);
 	rv = tty_port_block_til_ready(&acm->port, tty, filp);
+	if (rv < 0)
+		dbg("tty_port_block_til_ready returned %d", rv);
 done:
 	mutex_unlock(&acm->mutex);
 err_out:
Comment 6 Rafael J. Wysocki 2009-09-04 22:49:22 UTC
Handled-By : Oliver Neukum <oliver@neukum.org>
Comment 7 Paul Martin 2009-09-05 17:50:28 UTC
On Fri, Sep 04, 2009 at 11:04:21PM +0200, Oliver Neukum wrote:

> OK, please apply the included debugging patch, change "#undef DEBUG"
> in cdc-acm.c to "#define DEBUG", recompile and post dmesg.

usb 3-1: new full speed USB device using uhci_hcd and address 2
usb 3-1: New USB device found, idVendor=20df, idProduct=0001
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-1: Product: Entropy Key
usb 3-1: Manufacturer: Simtec Electronics
usb 3-1: SerialNumber: OQBuBlg0MTFBVxZD
usb 3-1: configuration #1 chosen from 1 choice
cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
cdc_acm 3-1:1.0: The data interface has switched endpoints
drivers/usb/class/cdc-acm.c: interfaces are valid
cdc_acm 3-1:1.0: ttyACM0: USB ACM device
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: 7
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: tty_port_block_til_ready returned -512
drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: ACM not ready
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_ctrl_irq - urb shutting down with status: -2
drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: tty_port_block_til_ready returned -512
drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: ACM not ready
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_ctrl_irq - urb shutting down with status: -2
Comment 8 Paul Martin 2009-09-09 01:48:12 UTC
Created attachment 23046 [details]
Tested patch from Oliver Neukum

This patch fixes both the Entropy Key and Nokia mobile phone problems.
Comment 9 Rafael J. Wysocki 2009-09-10 20:50:30 UTC
Handled-By : Oliver Neukum <oliver@neukum.org>
Patch : http://bugzilla.kernel.org/attachment.cgi?id=23046
Comment 10 Alan 2009-09-10 22:05:45 UTC
On Mon, 7 Sep 2009 17:09:32 +0200
Oliver Neukum <oliver@neukum.org> wrote:

> Am Montag, 7. September 2009 17:00:30 schrieb Alan Stern:
> > On Mon, 7 Sep 2009, Oliver Neukum wrote:
> > > Am Samstag, 5. September 2009 19:50:19 schrieb Paul Martin:
> > > > cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and
> > > > ISDN adapters drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
> > > > drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len:
> > > > 0x0 result: 0 drivers/usb/class/cdc-acm.c: tty_port_block_til_ready
> > > > returned -512
> > >
> > > This is very hard to explain. I can't see how tty_port_block_til_ready()
> > > can return -512
> > > Are you using any non-standard patches?
> > > Alan, does this make sense to you?i
> 
> I was actually referring to Alan Cox whom I had taken into cc.
> Sorry for being unclear.

There has been a change of Alan's for the USB serial stuff. I've also
been away so I've not reviewed Alan Stern's latest patches.
> 
> > No doubt it depends on which kernel is being used.  In my kernel, for
> > instance, tty_port_block_til_ready() will return -ERESTARTSYS in
> > multiple places if a hangup or a signal occurs.
> 
> Yes, but then it would work and user space knew it had to retry.
> -512 simply does not look like a valid error return. I must be even
> denser than usual.

One thing to check is if the app sets a timer and calls open which for
some reason then doesn't see a carrier signal being raised if clocal is
not set.

If clocal is not set by default on acm ports we can certainly set clocal
in the initial port setup if its causing a regression due to a dumb app
not coping with working POSIX compliance.

Alan
Comment 11 Paul Martin 2009-09-10 23:06:54 UTC
On Mon, Sep 07, 2009 at 04:34:48PM +0200, Oliver Neukum wrote:
> Am Montag, 7. September 2009 15:46:20 schrieb Paul Martin:
> > > OK, please apply the included debugging patch, change "#undef DEBUG"
> > > in cdc-acm.c to "#define DEBUG", recompile and post dmesg.
> >
> > You might be interested to know that I get exactly the same errors with a
> > Nokia mobile phone in "default" mode.
> 
> This is extremely interesting, as it points to a general failure.
> But I cannot see how the return value comes about. To double check
> could you commented out those lines in cdc-acm.c and try again?
> 
>       rv = tty_port_block_til_ready(&acm->port, tty, filp);
>       if (rv < 0)
>               dbg("tty_port_block_til_ready returned %d", rv);

This works. I'm on Linus 2.6.31-rc9 with the following modifiacation:

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 2bfc41e..4761a2d 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -51,7 +51,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#undef DEBUG
+#define DEBUG
 #undef VERBOSE_DEBUG
 
 #include <linux/kernel.h>
@@ -609,7 +609,11 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
 	acm->throttle = 0;
 
 	tasklet_schedule(&acm->urb_task);
+/*
 	rv = tty_port_block_til_ready(&acm->port, tty, filp);
+	if (rv < 0)
+		dbg("tty_port_block_til_ready returned %d", rv);
+*/
 done:
 	mutex_unlock(&acm->mutex);
 err_out:

dmesg output:

usb 3-1: new full speed USB device using uhci_hcd and address 3
usb 3-1: New USB device found, idVendor=0421, idProduct=0491
usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 3-1: Product: Nokia 6233
usb 3-1: Manufacturer: Nokia
usb 3-1: configuration #1 chosen from 1 choice
cdc_acm 3-1:1.1: Ignoring descriptor: type fd, length 4
drivers/usb/class/cdc-acm.c: interfaces are valid
cdc_acm 3-1:1.1: ttyACM0: USB ACM device
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: 7
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver cdc_ether
usb 3-1: bad CDC descriptors
usbcore: registered new interface driver rndis_host
usb 3-1: bad CDC descriptors
usbcore: registered new interface driver rndis_wlan
drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528b80, rcv 0xf5706310, buf 0xf5706450
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528d00, rcv 0xf57062fc, buf 0xf570643c
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528980, rcv 0xf57062e8, buf 0xf5706428
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528600, rcv 0xf57062d4, buf 0xf5706414
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528900, rcv 0xf57062c0, buf 0xf5706400
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528680, rcv 0xf57062ac, buf 0xf57063ec
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528200, rcv 0xf5706298, buf 0xf57063d8
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528c80, rcv 0xf5706284, buf 0xf57063c4
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528000, rcv 0xf5706270, buf 0xf57063b0
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528f80, rcv 0xf570625c, buf 0xf570639c
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528f00, rcv 0xf5706248, buf 0xf5706388
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528280, rcv 0xf5706234, buf 0xf5706374
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528a00, rcv 0xf5706220, buf 0xf5706360
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528e00, rcv 0xf570620c, buf 0xf570634c
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe4528780, rcv 0xf57061f8, buf 0xf5706338
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: sending urb 0xe44f4f80, rcv 0xf57061e4, buf 0xf5706324
drivers/usb/class/cdc-acm.c: input control lines: dcd- dsr+ break- ring- framing- parity- overrun-
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_ctrl_irq - urb shutting down with status: -2
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
drivers/usb/class/cdc-acm.c: Entering acm_read_bulk with status -2
cdc_acm 3-1:1.2: Aborting, acm not ready
usb 3-1: USB disconnect, address 3
drivers/usb/class/cdc-acm.c: Entering stop_data_traffic
Comment 12 Paul Martin 2009-09-10 23:07:03 UTC
On Tue, Sep 08, 2009 at 02:38:53PM +0200, Oliver Neukum wrote:
> Am Montag, 7. September 2009 21:59:37 schrieb Paul Martin:
> > > This is extremely interesting, as it points to a general failure.
> > > But I cannot see how the return value comes about. To double check
> > > could you commented out those lines in cdc-acm.c and try again?
> > >
> > >       rv = tty_port_block_til_ready(&acm->port, tty, filp);
> > >       if (rv < 0)
> > >               dbg("tty_port_block_til_ready returned %d", rv);
> >
> > This works. I'm on Linus 2.6.31-rc9 with the following modifiacation:
> 
> OK, please test this patch.

That works. Just to confirm, this is how git diff shows things:

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 2bfc41e..765264f 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -57,6 +57,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
+#include <linux/serial.h>
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <linux/tty_driver.h>
@@ -609,7 +610,11 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)
 	acm->throttle = 0;
 
 	tasklet_schedule(&acm->urb_task);
+	set_bit(ASYNCB_INITIALIZED, &acm->port.flags);
 	rv = tty_port_block_til_ready(&acm->port, tty, filp);
+	if (rv < 0)
+		dbg("tty_port_block_til_ready returned %d", rv);
+
 done:
 	mutex_unlock(&acm->mutex);
 err_out:
Comment 13 Paul Martin 2009-09-10 23:07:11 UTC
> OK, please apply the included debugging patch, change "#undef DEBUG"
> in cdc-acm.c to "#define DEBUG", recompile and post dmesg.

You might be interested to know that I get exactly the same errors with a
Nokia mobile phone in "default" mode.

usb 3-2: new full speed USB device using uhci_hcd and address 3
usb 3-2: New USB device found, idVendor=0421, idProduct=0491
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 3-2: Product: Nokia 6233
usb 3-2: Manufacturer: Nokia
usb 3-2: configuration #1 chosen from 1 choice
cdc_acm 3-2:1.1: Ignoring descriptor: type fd, length 4
drivers/usb/class/cdc-acm.c: interfaces are valid
cdc_acm 3-2:1.1: ttyACM0: USB ACM device
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x20 val: 0x0 len: 0x7 result: 7
usbcore: registered new interface driver cdc_ether
usb 3-2: bad CDC descriptors
usbcore: registered new interface driver rndis_host
usb 3-2: bad CDC descriptors
usbcore: registered new interface driver rndis_wlan
drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
drivers/usb/class/cdc-acm.c: input control lines: dcd- dsr+ break- ring- framing- parity- overrun-
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: tty_port_block_til_ready returned -512
drivers/usb/class/cdc-acm.c: Entering acm_rx_tasklet
drivers/usb/class/cdc-acm.c: acm_rx_tasklet: ACM not ready
drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x0 len: 0x0 result: 0
drivers/usb/class/cdc-acm.c: acm_ctrl_irq - urb shutting down with status: -2
usb 3-2: USB disconnect, address 3
drivers/usb/class/cdc-acm.c: Entering stop_data_traffic
Comment 14 Alan Stern 2009-09-11 00:00:37 UTC
On Mon, 7 Sep 2009, Oliver Neukum wrote:

> Am Samstag, 5. September 2009 19:50:19 schrieb Paul Martin:
> > cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN
> > adapters drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
> > drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0
> result: 0 
> > drivers/usb/class/cdc-acm.c: tty_port_block_til_ready returned -512
> 
> This is very hard to explain. I can't see how tty_port_block_til_ready()
> can return -512
> Are you using any non-standard patches?
> Alan, does this make sense to you?i

No doubt it depends on which kernel is being used.  In my kernel, for 
instance, tty_port_block_til_ready() will return -ERESTARTSYS in 
multiple places if a hangup or a signal occurs.

Alan Stern
Comment 15 Alan Stern 2009-09-11 00:00:45 UTC
On Mon, 7 Sep 2009, Oliver Neukum wrote:

> Am Samstag, 5. September 2009 19:50:19 schrieb Paul Martin:
> > cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN
> > adapters drivers/usb/class/cdc-acm.c: Entering acm_tty_open.
> > drivers/usb/class/cdc-acm.c: acm_control_msg: rq: 0x22 val: 0x3 len: 0x0
> result: 0 
> > drivers/usb/class/cdc-acm.c: tty_port_block_til_ready returned -512
> 
> This is very hard to explain. I can't see how tty_port_block_til_ready()
> can return -512
> Are you using any non-standard patches?
> Alan, does this make sense to you?i

No doubt it depends on which kernel is being used.  In my kernel, for 
instance, tty_port_block_til_ready() will return -ERESTARTSYS in 
multiple places if a hangup or a signal occurs.

Alan Stern
Comment 16 Rafael J. Wysocki 2009-10-01 22:48:01 UTC
Fixed by commit 7af25b4b34a2439020d78da765a3bed0ff73f25c.
Comment 17 bbjh1 2010-08-06 18:31:06 UTC
(In reply to comment #5)
> Reply-To: oliver@neukum.org
> 
> Am Freitag, 4. September 2009 19:42:47 schrieb Paul Martin:
> > On Fri, Sep 04, 2009 at 12:58:40PM +0200, Oliver Neukum wrote:
> > > Am Donnerstag, 3. September 2009 23:59:02 schrieb Andrew Morton:
> > > > > # cat /dev/ttyACM0
> > > > > cat: /dev/ttyACM0: Input/output error
> > > > >
> > > > > This device works in 2.6.30, but is broken in 2.6.31-rc1 and
> > > > > following.
> > >
> > > Please provide lsusb -v? Anything in the syslog? Please do an strace.
> > > I'd like to know whether it errors in open or read.
> >
> > It was attached to the original bug.
> >
> > http://bugzilla.kernel.org/attachment.cgi?id=22952
> >
> > From the strace:
> > ..
> > open("/dev/ttyACM0", O_RDONLY|O_LARGEFILE) = -1 EIO (Input/output error)
> > ..
> 
> OK, please apply the included debugging patch, change "#undef DEBUG"
> in cdc-acm.c to "#define DEBUG", recompile and post dmesg.
> 
>     Regards
>         Oliver
> 
> --
> 
> commit e1b8b513bcba5313efa8b1637c5d9490a1944236
> Author: Oliver Neukum <oliver@neukum.org>
> Date:   Fri Sep 4 19:53:04 2009 +0200
> 
>     usb:cdc-acm: additional debugging output
> 
> diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
> index 2bfc41e..d4e6c05 100644
> --- a/drivers/usb/class/cdc-acm.c
> +++ b/drivers/usb/class/cdc-acm.c
> @@ -610,6 +610,8 @@ static int acm_tty_open(struct tty_struct *tty, struct
> file
> *filp)
> 
>      tasklet_schedule(&acm->urb_task);
>      rv = tty_port_block_til_ready(&acm->port, tty, filp);
> +    if (rv < 0)
> +        dbg("tty_port_block_til_ready returned %d", rv);
>  done:
>      mutex_unlock(&acm->mutex);
>  err_out:

Hi 

I am facing the same problem with my ACM0 device. Now I understand I need to add the patch you provided but I was wondering if you can provide me with steps on how can I add the patch and where and how can I recompile the cdc-acm.c file. The kernel I am using is linux 2.6.31. I am sorry if my questions are silly but I am still new with all of this. Thank you again.

bbjh1