|
From: Uwe B. <bo...@el...> - 2010-10-05 16:42:52
|
Hallo, for FTDI devices, in most cases ftdi_sio is loaded. To talk to the device via libusb/libftdi, the kernel mode driver needs to be unloaded. However this defeats exclusive access, as a second open on the device will now see "usbfs" as the kernel mode driver and the same mechanism that unloaded ftdi_sio will happily "unload" "usbfs" and give access to the second open(). Appended patch checks now for "usbfs" driver string and returns another value in that case. Higher levels may now check the return value and refrain to call libusb_detach_kernel_driver() and so provide excusive access inside usbfs/libusb. Bye -- Uwe Bonnes bo...@el... Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- >From a996c049d1b2216c2db4158501ba1a3acc8707ec Mon Sep 17 00:00:00 2001 From: Uwe Bonnes <bo...@el...> Date: Tue, 5 Oct 2010 17:56:33 +0200 Subject: Allow to distinguish between other kernel mode drivers and usbfs --- libusb/os/linux_usbfs.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index 96ae135..885ab43 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -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; } -- 1.7.1 |