0
votes

My device is :16c0:05dc

''''> $ lsusb Bus 002 Device 005: ID 0a5c:5800 Broadcom Corp. BCM5880 Secure

Applications Processor Bus 002 Device 007: ID 1cbe:00fd Luminary Micro Inc. In-Circuit Debug Interface Bus 002 Device 006: ID 16c0:05dc Van Ooijen Technische Informatica shared ID for use with libusb Bus 002 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub Bus 002 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 006: ID 1bcf:280b Sunplus Innovation Technology Inc. Bus 001 Device 005: ID 413c:8187 Dell Computer Corp. DW375 Bluetooth Module Bus 001 Device 007: ID 040b:2000 Weltrend Semiconductor Bus 001 Device 004: ID 413c:2513 Dell Computer Corp. internal USB Hub of E-Port Replicator Bus 001 Device 008: ID 0781:558c SanDisk Corp. Bus 001 Device 003: ID 413c:2513 Dell Computer Corp. internal USB Hub of E-Port Replicator Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub [alexb@latitude ve12demo_fw6a]$ ll /dev/bus/usb/002/006 crw-rw-rw- 1 root users 189, 133 Aug 7 01:35 /dev/bus/usb/002/006 '''' my rule is: '''$ cat /etc/udev/rules.d/61-vedemo.rules SUBSYSTEM=="usb",ATTRS{idVendor}=="16c0",ATTRS{idProduct}=="05dc",GROUP="users",MODE="0666" SUBSYSTEM=="usb",ATTRS{idVendor}=="16c0",ATTRS{idProduct}=="05dc", ENV{ID_MM_DEVICE_IGNORE}="1" ''' However lsusb failed to claim interface 0 with error(-6 ):LIBUSB_ERROR_BUSY Note:

        
$ lsof /dev/bus/usb/002/006
[alexb@latitude ve12demo_fw6a]$ fuser -m  /dev/bus/usb/002/006
        

/dev/bus/usb/002/006: 18207 18225 18238 18240 18242m 18294 18437 18444 18447 18478 18512 18518 18534 18544 18548 18549 18551 18555 18568 18573 18577 18586 18592 18603 18607 18614 18616 18623 18628 18638 18640 18644 18646 18648 18655 18657 18660 18662 18663 18678 18681 18683 18688 18690 18691 18698 18702 18705 18754 18759 18760 18772 18773 18792 18811 18849 18866 18909 18910 18947 18951 18952 18970 18997 19021 19039 19045 19046 19083 19125 19144 19175 19372 19407 19568 19949 19970 20427 32612 40417 40495 40529 40587 40631 40778 41056 41876 Note1:note , that killing those processes with kill -9 28207 218225 etc. will crash the system..... Please help me to identify who is claiming my device prior to me? Note2:before claiming interface I do detach kernel driver and set autodetach true, see code below:

Blockquote

         rc=libusb_kernel_driver_active( dev_handle, INTERFACENUMBER);
                 if(rc==1)
                 {
                 rc=libusb_detach_kernel_driver(dev_handle, INTERFACENUMBER);
                 if(rc!=LIBUSB_SUCCESS) errmsg(__LINE__,__FILE__,"kernel driver failed to be  detached",rc,true);
                 };

rc=libusb_set_auto_detach_kernel_driver(dev_handle, true);

         rc=libusb_kernel_driver_active( dev_handle, INTERFACENUMBER);
                 if(rc==1)
                 {
                 rc=libusb_detach_kernel_driver(dev_handle, INTERFACENUMBER);
                 if(rc!=LIBUSB_SUCCESS) errmsg(__LINE__,__FILE__,"kernel driver failed to be  detached",rc,true);
                 };

  
Sincerely, Alex.
1
Welcome to StackOverflow. Your question contains solid information. Unfortunately, the formatting has gone horribly wrong: output is now mixed with your notes, relevant line breaks in output have been removed etc. Please edit and improve your question. Tips: Copy code and output into the question, select it and format it with the { } button afterwards. Do not use blockquote for it as is not suitable for code.Codo
# dmesg | grep 16c0 [ 2.601582] usb 2-1.4.1: New USB device found, idVendor=16c0, idProduct=05dc, bcdDevice= 1.00 [root@latitude ve12demo_fw6a]# cat /sys/bus/usb/drivers/usb/2-1.4.1/port/device/driver/usb2/uevent, # cat /sys/bus/usb/drivers/usb/2-1.4.1/port/device/driver/usb2/uevent MAJOR=189 MINOR=128 DEVNAME=bus/usb/002/001 DEVTYPE=usb_device DRIVER=usb PRODUCT=1d6b/2/418 TYPE=9/0/0 BUSNUM=002 DEVNUM=001alexbour
1st 2nd find udev event:alexbour
As we see, kernel ignore udev rules and assign adriver for my device! How it could be fixed? # cat /sys/bus/usb/drivers/usb/2-1.4.1/port/device/driver/usb2/uevent MAJOR=189 MINOR=128 DEVNAME=bus/usb/002/001 DEVTYPE=usb_device DRIVER=usb PRODUCT=1d6b/2/418 TYPE=9/0/0 BUSNUM=002 DEVNUM=001alexbour
Please edit your question and clean it up. Adding output as comments makes it worse.Codo

1 Answers

0
votes

the reason for this behavior was not udev, but qt, which called libusb_claim twice. To ensure single shot even in multi-threading environment QTimer single _shot function was used, and it solved the problem. [https://stackguides.com/questions/14269766/using-qt-how-to-call-function-once-after-a-certain-interval-even-if-more-calls]