Timo Behrendt ff8bc15bc5
All checks were successful
CD / build (amd64, usbmakroboard-amd64, linux_amd64) (push) Successful in 1m9s
CD / build (arm64, usbmakroboard-arm64, linux_arm64) (push) Successful in 4m0s
CD / release (push) Successful in 7s
feat: add default config path (#4)
Reviewed-on: #4
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-12-27 13:29:53 +01:00
2024-05-06 20:38:43 +02:00
2024-05-06 20:38:43 +02:00
2025-12-27 13:29:53 +01:00
2024-05-06 20:38:43 +02:00
2024-05-09 11:51:53 +02:00
2024-05-06 20:38:43 +02:00
2024-05-06 20:31:49 +02:00
2025-12-27 13:29:53 +01:00
2025-12-27 13:05:35 +01:00

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 provided by either specifying a config file path via the -c parameter. If no parameter is provided, the default config path under $HOME/.config/UsbMakroBoard.yaml is used.

Find the config schema in schemas/config.schema.json as well as a default config in config.yaml.

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:

  1. Identify the device's vendor and product IDs. You can do this by running lsusb in the terminal and looking for your device. This may looke like this where 195d is the vendor_id and 6008 is the product_id:

    # lsusb
    Bus 003 Device 005: ID 195d:6008 Itron Technology iONE Falcon 20 RGB
    
  2. Create a new udev rule. Open a new file in the /etc/udev/rules.d/ directory. The filename should end with .rules, for example 90-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). Replace vendor_id and product_id with your device's IDs from the first step.

    SUBSYSTEM=="input", ATTRS{idVendor}=="vendor_id", ATTRS{idProduct}=="product_id", MODE="0666"
    
  3. 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.

Description
No description provided
Readme GPL-3.0 101 KiB
0.1.0 Latest
2025-12-27 13:29:53 +01:00
Languages
C++ 85.8%
CMake 14.2%