The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* PROBLEM: USB ACM device does not work
@ 2009-06-28 18:29 Arseniy Lartsev
  2009-06-28 20:20 ` Oliver Neukum
  2009-06-28 20:58 ` Oliver Neukum
  0 siblings, 2 replies; 18+ messages in thread
From: Arseniy Lartsev @ 2009-06-28 18:29 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1497 bytes --]

I've got a piece of hardware (this one:
http://masterkit.ru/main/set.php?num=1153) which acts like an USB ACM
device and is handeled by the cdc_acm module. /dev/ttyACM0 does appear
but any attempt to write something to the device with a simple
"echo something >/dev/ttyACM0" fails with "Invalid argument" error.

The reason is that the driver calls usb_submit_urb in acm_start_wb()
but doesn't set interval in the urb structure, so it remains zero and
causes usb_submit_urb to return -EINVAL. Reading from device also does
not work due to the same problem in acm_rx_tasklet().

After setting urb interval to 128, this particular device works fine
for me (though I'm not sure that it's a right solution in general).

Corresponding patch (against 2.6.30) is:

--- linux-2.6.30.orig/drivers/usb/class/cdc-acm.c
+++ linux-2.6.30/drivers/usb/class/cdc-acm.c
@@ -182,6 +182,7 @@ static int acm_start_wb(struct acm *acm,
 	wb->urb->transfer_dma = wb->dmah;
 	wb->urb->transfer_buffer_length = wb->len;
 	wb->urb->dev = acm->dev;
+	wb->urb->interval = 128;
 
 	if ((rc = usb_submit_urb(wb->urb, GFP_ATOMIC)) < 0) {
 		dbg("usb_submit_urb(write bulk) failed: %d", rc);
@@ -453,6 +454,7 @@ urbs:
 				  acm_read_bulk, rcv);
 		rcv->urb->transfer_dma = buf->dma;
 		rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+		rcv->urb->interval = 128;
 
 		/* This shouldn't kill the driver as unsuccessful URBs are returned to the
 		   free-urbs-pool and resubmited ASAP */


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 315 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-07-01 14:34 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-28 18:29 PROBLEM: USB ACM device does not work Arseniy Lartsev
2009-06-28 20:20 ` Oliver Neukum
2009-06-28 20:37   ` Arseniy Lartsev
2009-06-28 20:58 ` Oliver Neukum
2009-06-29 11:43   ` Arseniy Lartsev
2009-06-29 13:07     ` Oliver Neukum
2009-06-29 13:35       ` Arseniy Lartsev
2009-06-30  7:22         ` Oliver Neukum
2009-06-30 20:09           ` Arseniy Lartsev
2009-06-30 21:01             ` Alan Stern
2009-07-01  9:01               ` Arseniy Lartsev
2009-07-01 10:56                 ` Oliver Neukum
2009-07-01 11:24                   ` Arseniy Lartsev
2009-07-01 11:37                     ` Oliver Neukum
2009-07-01 12:27                       ` [PATCH] cdc-acm: work around some broken devices Arseniy Lartsev
2009-07-01 13:56                         ` Greg KH
2009-07-01 14:03                           ` Oliver Neukum
2009-07-01 14:34                         ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox