Xiaofan Chen | 1 Nov 2010 05:06
Picon

Re: [libusb] #70: device removal breaks internal state, making later libusb_open calls always fail

On Thu, Oct 28, 2010 at 4:07 AM, Peter Stuge <peter <at> stuge.se> wrote:
> Pete Batard wrote:
>> On 2010.10.27 15:46, libusb Trac wrote:
>> >   Since this is a backend problem I would very much appreciate if someone
>> >   could test for this problem also on MacOS X and Windows.
>>
>> Tested for Windows using the sample program attached to the trac issue.
>
> Thanks for testing!
>
>
>> Haven't observed crashes of libusb,
>
> Note that there is no crash as in access violation. The "crash"
> refers to internal state which makes libusb_open fail.
>

I just tested it under Linux and actually the program does not work
even without unplug/plug. Strange.

Without the sleep(1) code, even without unplug/plug the program
does not work.

Initially it works, after a while, the program failed like this.

try to open device...
libusb:error [sysfs_scan_device] open busnum failed, errno=24
could not open device

try to open device...
libusb:error [sysfs_scan_device] open busnum failed, errno=24
could not open device

...

With the sleep(1) code, it works with or without unplug/plug.

The OS is Ubuntu 10.10 (kernel 2.6.35-22), libusb-1.0 is
from latest libusb.git.

--

-- 
Xiaofan

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev

Gmane