0

We are a hardware vendor and want to provide support for linux. This means we want to provide a (user space) shared library that can be used by our customers applications without struggling with the lowlevel protocol.

Our Hardware is accessed via USB/HID and thus our library need to get access to /dev/hidrawX.

But to get access to this device (or other kind of hardware devices) it seems that we need to modify the system by adding permissions to the udev system (see Get access to USB device on Linux (libusb-1.0)?).

Is this really best practice? If so, where should I do this? In the .deb/.rpm/... installer of the customers application? What about FlatPak or similar concepts?

mrh1997
  • 922
  • 7
  • 18
  • You have only chance in deb/rpm packages, because their postinstall script runs as root, and you have to be root to add custom udev rules. Flatpak and similar sandboxed projects can't modify the root filesystem, like udev rules. – Ipor Sircer Nov 21 '17 at 10:58
  • Is there at least a "best practice" how to add this to .deb/.rpm postinstall scripts to ensure that the settings are cleanly resetted when uninstalling the package again? – mrh1997 Nov 21 '17 at 15:41

1 Answers1

-1

Udev is standard and best practice. Every linux distribution has udev rules files typically for ex in case of ubuntu it is found in /etc/udev/rules.d folder. You need to create a udev rule file and write MODE="0666" rule to it. Take a look at this example for how to write udev rule.

Hercules dd
  • 215
  • 1
  • 5
  • My question was not how to use udev (I added already a link on how to do this myself). My question was about best practices. – mrh1997 May 21 '19 at 21:23