On 22/09/2010 00:13, Chris Frey wrote:
> 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 :-)
Sorry about that, in my haste in writing the email I managed to put the 
commit number in the wrong place! The zero size reads comment should 
have been with the next commit I mentioned...
>> 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.
Good point. I was thinking in terms of what a zero byte read on a socket 
would means, but obviously this isn't a socket.

Regards,

Toby

------------------------------------------------------------------------------
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

Reply via email to