|
From: Michael P. <mic...@gm...> - 2010-10-06 14:10:54
|
Uwe Bonnes wrote:
>> @@ -1242,7 +1242,8 @@ static int op_kernel_driver_active(struct
libusb_device_handle *handle,
>> "get driver failed error %d errno %d", r, errno);
>> return LIBUSB_ERROR_OTHER;
>> }
>> -
>> + if (!(strcmp(getdrv.driver,"usbfs")))
>> + return 2;
>> return 1;
>> }
Is a typical use then:
int isactive = libusb_kernel_driver_active(...);
// point A
if(isactive==1) {
libusb_detach_kernel_driver(...);
} else if(isactive==2) {
printf("in use\n");
exit(...);
}
libusb_claim_interface(...);
// point B
? If so....
Now what if two such programs are running? Say program 1 checks and find
isactive==1, and stops at point A. Program 2 checks and find isactive==1,
detaches ftdi_sio and claims the interface, and stops at point B (or later).
Now program 1 resumes, detaches the usbfs of program 2, and claims the
interface itself. If I understand the original thread from Apr 2009
correctly, we're back where we started, if only rarely.
Is there also a similar situation when reattaching at the end?
Michael
|