|
From: chen h. <ch...@xa...> - 2006-03-30 07:06:33
|
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
|