Re: USB Gadget Serial Blocking Read Problem

David Brownell <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Friday 13 July 2007, Sagusti.Robert wrote:
> Hi,
> 
> I'm running kernel 2.6.20 on an AT91RM9200 processor. I have
> the gadget serial driver loaded and I am successfully reading
> and writing data in and out the USB port to a windows terminal.
> In my user code, when I open the gadget driver port, I open it
> with the default blocking flag so that my user thread will
> sleep while waiting for data to come in. My problem is that
> when I pull the USB cable which causes a disconnect, the read()
> call never returns in my user code thereby locking the thread
> that it is called in.        

Looks like gs_free_ports() only updates the write side,
not the read side ...


> I have turned on debugs in the driver's module and am I am
> monitoring the Gadget Driver in another thread by cat /proc/kmsg
> and can clearly see that the Gadget Driver function
> gs_disconnect(struct usb_gadget *gadget) is being called. The
> driver reacts fine to the connects and disconnects but the user
> mode read() function is the problem. I'm pretty new to driver
> development and I've been attempting to trace the problem
> through the tty driver and the line discipline to attempt
> to understand how things work. After 3 days, I'm gaining some
> understanding but I really could use some help.         
> 
> I would think that lots of apps would have to handle the USB
> cord being yanked out. Does anyone have any insight into this?  

Just that this is clearly a bug in the serial gadget code.

The way gadget drivers are supposed to handle disconnect
events is to (cleanly) shut down all pending I/O ... and
it's not doing that except for write operations.

- Dave

 
> Thanks for reading.
> 
> 
> 
> 
> Robert P. Sagusti
> ENSCO Inc., APA Division
> 5400 Port Royal Rd.
> Springfield, VA  22151
> (703) 321-4407
> [email protected]
> 




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.