librazer
A Rust library for controlling Razer laptop BIOS settings via USB HID protocol.
Features
- Cross-platform support (Linux and Windows)
- Automatic device detection
- Performance mode control (Silent, Balanced, Custom)
- Fan control (Auto, Manual RPM, Max Speed)
- CPU/GPU boost configuration
- Keyboard backlight brightness
- Lid logo control (on supported models)
- Battery care mode
- Compile-time feature validation per device
Installation
Add to your Cargo.toml:
[]
= "0.7"
Linux Requirements
Install libudev-dev for USB HID support:
# Debian/Ubuntu
# Fedora
Usage
Auto-detect and connect
use ;
Set performance mode
use ;
Custom CPU/GPU boost
use ;
Manual fan control
use ;
Other settings
use ;
Supported Devices
| Model | Model Number | Features |
|---|---|---|
| Razer Blade 14" (2023) Mercury | RZ09-0482X | Perf, Fan, Keyboard, Battery Care, Lights Always On |
| Razer Blade 16" (2023) Black | RZ09-0483T | Perf, Fan, Keyboard, Logo, Battery Care, Lights Always On |
Adding Device Support
- Find your device's USB PID:
lsusb | grep 1532 - Get model number from Razer support (format: RZ09-XXXXX)
- Add a
Descriptorentry insrc/descriptor.rs:
Descriptor ,
Protocol
Communication uses 90-byte USB HID feature reports:
| Bytes | Purpose |
|---|---|
| 0-1 | Status + transaction ID |
| 2-7 | Protocol metadata (data_size, command_class, command_id) |
| 8-87 | Command arguments (80 bytes) |
| 88 | CRC (XOR of bytes 2-87) |
| 89 | Reserved |
Razer vendor ID: 0x1532
Acknowledgments
- tdakhran/razer-ctl - Original reverse engineering
- openrazer - USB protocol documentation
License
MIT