Reviewed-on: #6 Co-authored-by: Timo Behrendt <t.behrendt@t00n.de> Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
UsbMakroBoard
Kudos
For info that with "EVIOCGRAB" the keyboard events can be consumed exclusively by one application: https://stackoverflow.com/questions/29942421/read-barcodes-from-input-event-linux-c/29956584#29956584
Arguments
-c <path to config>
Configuration
The configuration can be
Allowing non-root access to the device
By default, accessing input devices requires root privileges. However, it's possible to allow a regular user to access a specific input device by creating a udev rule:
-
Identify the device's vendor and product IDs. You can do this by running
lsusbin the terminal and looking for your device. This may looke like this where195dis thevendor_idand6008is theproduct_id:# lsusb Bus 003 Device 005: ID 195d:6008 Itron Technology iONE Falcon 20 RGB -
Create a new udev rule. Open a new file in the
/etc/udev/rules.d/directory. The filename should end with.rules, for example90-input.rules(the number determins the order in which the rules are loaded. It is generally recommended to chose higher numbers for changes that are relevant for the user-space).In the new file, write a rule that matches your device and sets the mode to
0666(read and write permissions for everyone). Replacevendor_idandproduct_idwith your device's IDs from the first step.SUBSYSTEM=="input", ATTRS{idVendor}=="vendor_id", ATTRS{idProduct}=="product_id", MODE="0666" -
Reload the udev rules with the command
sudo udevadm control --reload-rules && sudo udevadm trigger.
Now, every time the device is connected, it will be accessible by all users. The rule can be made more specific to only make the device accessible to a certain user or user group. You can use the OWNER, GROUP, and MODE parameters in the udev rule. For example, to restrict access to the user username and the group usergroup, you can use:
SUBSYSTEM=="input", ATTRS{idVendor}=="vendor_id", ATTRS{idProduct}=="product_id", OWNER="username", GROUP="usergroup", MODE="0660"
This will give read and write permissions to the user and/or the group, and no permissions to others.