Skip to content

lulinretrograde/hidwizard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hidwizard

A sleek terminal UI for granting WebHID (and other hidraw) access to HID devices on Linux.

Browsers can talk to HID devices through the WebHID API, that's how tools like VIA, Vial, and the Keychron launcher configure keyboards straight from the browser. On Linux, though, a userspace app (your browser) can't open a hidraw node without a matching udev rule. Without one you get NotAllowedError: Failed to open the device.

hidwizard finds your HID devices, lets you pick the ones you want to expose, and writes a minimal uaccess udev rule for them, no hand-editing vendor IDs.

  • Live device list, hotplugged devices appear automatically, no manual rescan.
  • Already-ruled badge, devices the rule file already covers are marked ✓ruled.
  • Write diff + confirmation, before writing you see what's added / removed / kept.
  • Mouse or keyboard, click to toggle, scroll wheel to navigate.
╭ hidwizard · WebHID access for Linux        ● root ─────────────────────────╮
╰────────────────────────────────────────────────────────────────────────────╯
╭ Devices  (1 selected) ─────────────╮╭ Selected ─────────────────────────────╮
│ ▌ ◉ Keychron Q6 Max  3434:0ea0     ││ name    Keychron Q6 Max               │
│   ○ Logitech USB Mouse  046d:c52b  ││ vendor  3434                          │
│   ○ Yubico YubiKey  1050:0407      ││ product 0ea0                          │
│                                     │╰────────────────────────────────────────╯
│                                     │╭ Rule preview ─────────────────────────╮
│                                     ││ # Keychron Q6 Max                     │
│                                     ││ KERNEL=="hidraw*", SUBSYSTEM=="hidraw"…│
╰─────────────────────────────────────╯╰────────────────────────────────────────╯
 › 1 HID device(s) found. Space to select, w to write.
╭──── ↑↓ move  space select  a all  n none  w write  R reload  e existing  q ─╮
╰──────────────────────────────────────────────────────────────────────────────╯

Install

Requires a Rust toolchain.

git clone https://github.com/lulinretrograde/hidwizard
cd hidwizard
cargo build --release
sudo install -m755 target/release/hidwizard /usr/local/bin/hidwizard

Usage

Launch the TUI. Writing rules needs root, so run it with sudo:

sudo hidwizard
Key / Mouse Action
/ j/k Move cursor
scroll wheel Move cursor / scroll the rules view
space / click Toggle selection
a / n Select all / none
w Write the udev rule (opens confirm + diff)
R Reload & trigger udev (apply without reboot)
r Rescan devices now
e View the existing rule file (↑↓/PgUp/PgDn)
q / Esc Quit (or leave the existing-rules view)

Typical flow: sudo hidwizard → select your keyboard → wR → replug the device → open VIA/Vial/your launcher in a Chromium-based browser.

Non-interactive

hidwizard --list        # list detected HID devices
hidwizard --generate    # print the udev rule for all detected devices

What it writes

A single file at /etc/udev/rules.d/70-hidwizard.rules, one rule per selected device:

KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="3434", ATTRS{idProduct}=="0ea0", MODE="0660", TAG+="uaccess"

TAG+="uaccess" grants the rule to the locally logged-in user, no extra group membership needed. Re-running hidwizard overwrites the file with your current selection.

How it works

Devices are enumerated from /sys/class/hidraw (the kernel nodes WebHID actually uses), walking up the sysfs tree to read each device's idVendor / idProduct. No lsusb or other external dependency at runtime; the only external call is to udevadm for the reload.

Notes

  • WebHID is Chromium-only (Chrome, Edge, Brave, Vivaldi). Firefox and Safari do not implement it.
  • Some distros may soon ship a blanket uaccess rule for all hidraw devices via systemd (systemd#38991), which would make per-device rules unnecessary. Until then, this fills the gap.

Credits

Inspired by RitzDaCat/udev-autoconfig, which solves the same problem with a Python GUI/CLI. hidwizard is an independent reimplementation focused on a fast, single-binary terminal UI.

License

MIT

About

Sleek terminal UI to give Linux browsers WebHID access by writing uaccess udev rules. Fix hid devices for basically all web based hid configuration software.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages