usb_interrupt_read blocks "forever" sometimes

Hans Petter Selasky hselasky at c2i.net
Wed Feb 10 08:24:48 UTC 2010


On Wednesday 10 February 2010 08:08:08 Daniel O'Connor wrote:
> I am trying to talk to my WH1080 weather station and I find that
> sometimes when I start the program it will stall forever in
> usb_interrupt_read even though the timeout specified is 50 milliseconds.
> 
> I also tried using alarm() but that doesn't cause the transfer to abort
> (it appears the libusb code loops and doesn't check for EINTR).
> 

Hi,

I would not recommend using signals with libusb. It is not portable. Currently 
signals are ignored. What you would have to do, is to use the timeout argument 
which you are doing, and have a timekeeper variable somewhere, or create 
another thread. Still, when using the timeout there is a chance you can loose 
data.

--HPS


More information about the freebsd-usb mailing list