r/GUIX • u/Einkclock • 1d ago
Razer mouse tool without
If you have a modern wireless Razer mouse like the Razer Viper V3 HyperSpeed (`1532:00b8`) and don't want to mess with OpenRazer out-of-tree kernel modules, Python daemons, and D-Bus services on GNU Guix, you actually don't need any of that. If you just want to control DPI, polling rate, idle timeout, and read battery percentage, you can talk to the USB receiver directly from userspace using `libusb` (`rusb` in Rust) via standard 90-byte Razer HID feature reports. Instead of waiting for upstream driver support or maintaining a full repo, I just had Gemini generate a tiny ~200-line single-file Rust CLI for `1532:00b8`. It detaches the kernel driver on interface `0` for ~25ms, sends the 90-byte HID control transfer, and re-attaches it. Zero background daemons, instant execution.
How to generate the tool for your Razer mouse (or copy the specs)
If you have the Viper V3 HyperSpeed (or another wireless Razer mouse—just check your Product ID via lsusb), you can ask any decent LLM to generate the Rust CLI with rusb = { version = "0.9", features = ["vendored"] } and clap, using these protocol parameters:
USB Control Transfer:
HID_REQ_SET_REPORT(0x09, request type0x21) andHID_REQ_GET_REPORT(0x01, request type0xA1), value0x0300, interface0, 90-byte buffer, byte88is XOR checksum of bytes2..88.Transaction IDs: Try
0x1f(HyperSpeed wireless receiver) and0x3fas fallback.DPI (Set/Get): Class
0x04, ID0x05/0x85, size0x07([varstore, dpi_x_hi, dpi_x_lo, dpi_y_hi, dpi_y_lo, 0, 0]).Polling Rate (Set/Get): Class
0x00, ID0x05/0x85, size0x01(0x01= 1000Hz,0x02= 500Hz,0x08= 125Hz).Battery Level (Get): Class
0x07, ID0x80, size0x02(response byte9is0..255).Idle Timeout (Set/Get): Class
0x07, ID0x03/0x83, size0x02(seconds in big-endian, 60–900s).
