docs: ✏️ Add udev rules section for Linux HID permissions - #6
Open
sammyapoex wants to merge 1 commit into
Open
Conversation
The Troubleshooting section only said udev rules "may" be needed, with no
rule and no way to work one out. Add a section with the actual steps.
Both the USB raw-HID and ZMK Bluetooth paths open /dev/hidraw*, which most
distributions leave as root:root 0600. A single rule matching KERNELS on
"????:VID:PID.*" covers either bus. Note that ATTRS{idVendor} cannot work
for Bluetooth (the node is a uhid child with no USB attributes), that hex
matching is case sensitive, and that the input group is unrelated - it
governs /dev/input/event*, which this app never reads.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
|
I glad you contributed.. thanks.. |
Author
|
I accidentally opened this pr. I thought I had a clone of the repo. But I'm glad you appreciate it. I will submit another one soon (a fix for some freezing/hanging issues that I've had) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Troubleshooting section currently says only:
There is no rule, no example, and no way for a reader to work one out. On a stock setup this is the first thing that blocks the app:
/dev/hidraw*isroot:root 0600on most distributions, sohid.Device(path=...)raises a permission error and the app exits viaprint_instructions()— which points atconfig.inirather than at the real cause.What this adds
A
### Permission denied on Linux (udev rules)section under Troubleshooting covering:Finding your device's node —
grep -H -E 'HID_NAME|HID_ID' /sys/class/hidraw/*/device/ueventThe rule itself, matching on
KERNELSso a single line covers both the USB raw-HID path (libs/keyboard_hid.py) and the ZMK Bluetooth path (libs/keyboard_ble_hid.py):A dry-run check with
udevadm testso readers can confirm the match before reconnecting anythingNotes on the three things that are easy to get wrong (below)
The existing bullet now links to the new section instead of trailing off.
Why
KERNELSrather thanATTRS{idVendor}Most keyboard udev rules found in the wild match
ATTRS{idVendor}. That cannot work for the ZMK Bluetooth path. A BLE keyboard's hidraw node is created byuhid, so its parent chain ishid → misc/uhid → virtualwith no USB device anywhere in it and noidVendorattribute to match:The
KERNELSname is<bus>:<VID>:<PID>.<n>, present on both buses (0003USB,0005Bluetooth), so the????wildcard handles either connection with one rule.Verification
Checked against live devices with
udevadm test -D <dir>(a dry run — computes GROUP/MODE without re-permissioning), rather than from recall:GROUP="plugdev"→ gid 958,MODE→ 06601d50:615e)On the
inputgroupThe section states explicitly that
inputis not involved, because it is the common wrong guess. It governs/dev/input/event*, which this app never reads — it goes through HIDAPI tohidraw. Joininginputdoes not help, and it grants read access to every keystroke on the machine, so it is worth steering people away from.Caveats noted in the text
config.ini; readers are told to substitute their own from the discovery command.hidpackage binds to whichever HIDAPI it finds. This is hidraw on most distributions, but a libusb-backend distro would needSUBSYSTEM=="usb"rules instead — called out in the notes.TAG+="uaccess"is mentioned as the seat-local alternative to a group, with the caveat that the file must then sort before73-seat-late.rules.Docs only — no code changes.
🤖 Generated with Claude Code