On Tue, Sep 21, 2010 at 04:25:09PM +0100, Toby Gray wrote: > Hi, > > I've noticed that for some USB error, such as resetting the USB port, > then Barry wouldn't notice the error has occurred. I tracked this down > to Barry ignoring zero size reads, so I fixed that > (5bc30ce911ac3fb0b839)
This looks like a timeout bugfix... which is a good fix. I don't see the "ignoring zero size reads" though. I've merged this. Thanks :-) > but then discovered that if a usb error had been > seen then Socket::Close would hang on wait_pop while trying to receive > data, so I made DefaultRead return immediately if a usb error has been > seen (a41446a2ac3d9f96d859). In DoRead()... + if( data.GetSize() == 0 ) + // Reading 0 bytes indicates an error such as + // USB port reset. + // + // Any further attempts to read or write to + // the USB device will just hang. + throw Usb::Error(-EIO, "Read zero bytes from USB port"); I think this is the wrong place to handle USB errors, and the entire way to fix this depends on whether a zero read is always an error or not. I'm not sure that it is, but if so, then we can safely add a new exception, which would solve some of the Close() logic too. I'll ask on the libusb list. > (There's one other minor change in my branch at > git://github.com/tobygray/barry.git to remove an implicit magic constant > from a select call in the raw channel tool). Thanks, I merged that too. - Chris ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Barry-devel mailing list Barry-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/barry-devel