wulf7 / iichid

Generic HID layer for FreeBSD. Including I2C and USB backends.
BSD 2-Clause "Simplified" License
45 stars 6 forks source link

[hidraw] add /dev/uhidN alias #27

Closed valpackett closed 3 years ago

valpackett commented 4 years ago

Because e.g. Firefox would not look for hidraw devices on FreeBSD right now.

ref: https://github.com/mozilla/authenticator-rs/pull/62


Tested with a Yubikey and Firefox. devd with u2f rules sets u2f group (and group write permission) on the hidraw devices, uhid aliases are symlinks without the group write permission but that seems fine — works in Firefox.

wulf7 commented 4 years ago

The change triggers panic if created symlink already exists as uhid(4) character device or vice versa. To fix it both unit numbers should be allocated from the same pool. Currently uhid's pool is private and cannot not be directly accessed from outside of uhid.c. There are 2 ways to export it.

  1. Just make static devclass_t uhid_devclass; variable public. It requires changing of OS sources so can not be easily done before iichid/hidraw import in to the base system has happened.
  2. Create custom module load handler instead of current driver_module_handler(), which will attach hidraw driver to uhid devclass with using of devclass_find() and devclass_add_driver().

IMO 2-nd option is overkill, so I place the patch on hold untill hidraw hit the sources.

wulf7 commented 3 years ago

The change has been committed to 13-CURRENT. It is enabled with specifying of HIDRAW_MAKE_UHID_ALIAS kernel option. It can not be accepted by https://github.com/wulf7/iichid for the reason mentioned above. So close the pull request.