On Thu, Aug 30, 2007 at 03:33:36PM -0400, Mike Frysinger wrote:
> i noticed that while using minicom on a usb-serial device (PL2303), 
> disconnecting it would make minicom spike using all the cpu.  looking into 
> it, minicom does a simple select()/read() on the fd on the device, but those 
> functions werent returning errors so it kept on looping.  a simple test 
> program shows similar behavior: open a usb serial device, set the fd to 
> nonblocking, and then in a loop just keep doing a read().  while the usb 
> cable is plugged in, you get back the normal EAGAIN.  but when you unplug the 
> device, read() just returns 0 rather than ENODEV or EIO.

You should get a tty hangup sent on the filedescriptor, right?

And read returning 0 is just fine, I don't see why that is illegal, as
it's the tty layer returning that information.  You need to handle the
tty hangup event (and so should minicom, which I find hard to believe it
doesn't...)

What kernel version are you seeing this on?

thanks,

greg k-h

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to