9

I read the kernel documentation for hidraw and hiddev, and I understand the differences, but I am wondering how the kernel decides whether or not a device should show up as /dev/hidraw* or /dev/usb/hiddev*

Anthon
  • 78,313
  • 42
  • 165
  • 222

1 Answers1

2

It's passed as a parameter per driver to hid_hw_start()/hid_connect(). E.g:

hid-thingm.c:   err = hid_hw_start(hdev, HID_CONNECT_HIDRAW);

I guess that most drivers do something like this:

hid-logitech-dj.c:  retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);

And HID_CONNECT_DEFAULT includes HID_CONNECT_HIDRAW:

#define HID_CONNECT_DEFAULT     (HID_CONNECT_HIDINPUT|HID_CONNECT_HIDRAW| \
                HID_CONNECT_HIDDEV|HID_CONNECT_FF)

The exact same thing happens for both hidraw and hiddev.

V13
  • 4,551
  • 1
  • 15
  • 20