|
From: Black M. <bla...@ho...> - 2006-03-30 22:35:28
|
Yes, its a known problem that threading + libusb = bad.
plus, that only tells you if its attached. What iv done, is send a control
message from my main read/write thread, and have the device return somethng
like 'AOK', this tells you if its available, and if its actualy functioning
(and aquired)
>From: "chen hai" <ch...@xa...>
>Reply-To: lib...@li...
>To: "libusb-win32-devel" <lib...@li...>
>Subject: [Libusb-win32-devel] usb_bulk_read() + usb_find_devices() =
>stalled USB?
>Date: Thu, 30 Mar 2006 15:07:07 +0800
>
>Hi, folks:
>
>I'm writing a small program sampling datas from a USB device.
>
>In one thread, I read USB data with the following line:
> size = usb_bulk_read(apu_usb_dev, 0x81, buf, 320, 20);
>
>In another thread, I check the availablity of that USB device by calling
>the
>following function fired by a timer for every 3 seconds.
>
>int APU_USB_Ready(LPARAM lParam)
>{
> struct usb_bus * bus ;
> struct usb_device * dev ;
>
> usb_find_devices();
> for (bus = usb_get_busses(); bus ; bus = bus -> next) {
> for (dev = bus -> devices; dev; dev = dev -> next) {
> if (dev -> descriptor.idVendor == 0x5345 &&
> dev -> descriptor.idProduct == 0x1234)
> return 1 ;
> }
> }
> return 0 ;
>}
>
>It works for 20-40 minutes, then suddenly, size, the return value of
>usb_bulk_read()
>would get something less than zero, and the USB line is stalled. I checking
>the online
>manual of usb_bulk_read() and couldn't get much information there.
>
>Removed the call of APU_USB_Ready(), the program kept running for more than
>5 hours without
>getting any "less than 0" error from usb_bulk_read().
>
>Is this a known problem?
>
>Thanks
>
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live
>webcast
>and join the prime developer group breaking into this new coding territory!
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>_______________________________________________
>Libusb-win32-devel mailing list
>Lib...@li...
>https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
|