Hi linux-usb folks, I have been grappling with building a cdc_acm peripheral. To test it, I have been opening /dev/ttyACM0 readonly with one process and then writeonly with another, transmitting data, and checking if the data coming back is correct, then closing the file descriptors. Doing this many times in rapid succession, results in bulk IN requests occasionally not being sent as reported by usbmon. (The reading process hangs occasionally.) The following patch fixed it for me. I hope it is right. Thank you for your time, Henry From: Henry Gebhardt <gebhardt@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 3 Nov 2009 13:52:32 +0100 Subject: [PATCH] cdc_acm: Fix race condition when opening tty If acm_rx_tasklet() gets called before tty_port_block_til_ready() returns, then bulk IN urbs may not be sent. This fixes it. --- cdc-acm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cdc-acm.c b/cdc-acm.c index 16bcbda..e4f8682 100644 --- a/cdc-acm.c +++ b/cdc-acm.c @@ -609,9 +609,9 @@ 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); + tasklet_schedule(&acm->urb_task); done: mutex_unlock(&acm->mutex); err_out: -- 1.6.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html