Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Directly related: Prevent claiming of novelty usb device by usbhid so I can control it with libusb?

I want to access an RFID reader (works as HID device) from a program that uses libusb-0.1. In the code, the kernel driver is correctly detached with usb_detach_kernel_driver_np (no errors), but is seems that whenever my program tries to access the USB device, the usbhid module reclaims it. The following error always appears in dmesg:

usb 1-1.3: usbfs: interface 0 claimed by usbhid while 'MyProgram' sets config #1

I've added the following udev rule, restarted udevd and replugged the device, but without effect. It is supposed to blacklist the device from being used by usbhid.

# I anonymized the vendor/product IDs here
ATTRS{idVendor}=="dead", ATTRS{idProduct}=="beef", OPTIONS=="ignore_device"

Apart from dmesg output, I can see in /sys/bus/usb/drivers/usbhid/ that the device 1-1.3:1.0 is recreated every time, so the blacklisting doesn't seem to work.

Anything else I could try? The operating system is Raspbian (on a Raspberry Pi) with kernel 3.2.27.

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

I've solved this part of the problem:

  • OPTIONS=="ignore_device" was removed from the kernel (commit)
  • blacklist usbhid didn't do anything, not even blocked my keyboard
  • A configuration file in /etc/modprobe.d with options usbhid quirks=0xdead:0xbeef:0x0004 did not work because usbhid was not compiled as module

So, I added usbhid.quirks=0xdead:0xbeef:0x4 to the boot command line (on Raspbian, that's in /boot/cmdline.txt) and usbhid does not bind the device anymore.


My original problem, however, still remains. I always get a read/timeout error when accessing the RFID reader the first time.

share|improve this answer
add comment

I had the same problem and I solved modifying the udev rules file like this:

SUBSYSTEM=="input", GROUP="input", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="4242", ATTRS{idProduct}=="e131", MODE:="666", GROUP="users"

And now I can read the RFID logger by using libusb functions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.