2

I have a device which is using the usbhid driver.

I noticed a module folder inside the driver with a file name quirks.Can anyone tell me the correct way to edit this file and the values it can take?

    root@raspberrypi:/sys/bus/hid/drivers/generic-usb/module/parameters# dir
    ignoreled  mousepoll  quirks

By default it only contains the following value.

    (null),(null),(null),(null)

2 Answers 2

2

I believe you can find a list by module with modinfo

$ modinfo usbhid
...
parm:           quirks:Add/modify USB HID quirks by specifying  quirks=vendorID:productID:quirks where vendorID, productID, and quirks are all in 0x-prefixed hex (array of charp)

And you can give them as parameters while loading a module.

$ sudo modprobe -v usbhid "quirks=0xDEAD:0xBEEF:0x55AA"

I believe you can also just write these into a sysfs file at runtime in some cases. Seems the usbhid is read-only on my (desktop) system, though.

$ echo "0xDEAD:0xBEEF:0x55AA" | sudo tee -a /sys/module/usbhid/parameters/quirks
tee: /sys/module/usbhid/parameters/quirks: Permission denied

I haven't looked into these more and you'll need to find the actual values from somewhere (source, LXR?), but maybe that's a start.

3
  • The answer was really helpful.I was able to add quirks to the driver using the first method.Thanks.
    – SteveIrwin
    Commented Nov 9, 2012 at 7:29
  • Good to hear :)
    – XTL
    Commented Nov 9, 2012 at 7:30
  • @SteveIrwin where did you find the description for the quirks? I looked at lxr.free-electrons.com/source/include/linux/hid.h#L317 which is where they are #defined, unfortunately there is no description for them. Are the quirks names assumed to be descriptive enough? Or did you find any detailed info on each of them? If so could you point me to this info.
    – user10607
    Commented Dec 11, 2016 at 17:09
4

A real world example that I use

cat /sys/module/usb_storage/parameters/quirks
0bc2:3312:u,0bc2:ab38:u

Note that the format is vendor:device:flag[,...] and that , not \n must be used for multiple devices. There is a list of valid flags in the source here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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