A Python-based solution to control the Razer Basilisk V3 X HyperSpeed mouse on macOS, using the USB protocol ported from the OpenRazer project.
- DPI Control: Set custom DPI values (100-35,000) with quick presets
- Scroll Wheel LED: Control brightness and effects (Static, Spectrum, Wave, Breathing, Reactive)
- Battery Monitoring: Real-time battery level and charging status
- Device Information: Display firmware version and connection status
- Dark Theme UI: Razer-styled dark interface with green accents
- macOS
- Python 3.6+
- Razer Basilisk V3 X HyperSpeed mouse connected via USB
- Install dependencies:
pip install -r requirements.txt- You may need to install libusb on macOS:
brew install libusbThis approach runs a privileged daemon for USB access while your GUI runs with your normal Python environment:
- Run the GUI client (it will prompt for sudo to start the daemon):
python3 razer_gui_client.pyThe GUI will automatically start the daemon with sudo when needed.
Run the GUI directly with sudo:
sudo python3 razer_gui.pyUse the provided script to maintain your pyenv environment:
./run_with_pyenv.shOr use the control module directly:
from razer_control import RazerBasiliskControl, LEDEffect
# Connect to device
device = RazerBasiliskControl()
# Get battery level
battery = device.get_battery_level()
print(f"Battery: {battery}%")
# Set DPI
device.set_dpi(1600)
# Set LED effect
device.set_scroll_effect(LEDEffect.SPECTRUM)
# Close connection
device.close()The implementation uses the Razer USB HID protocol:
- Vendor ID: 0x1532 (Razer)
- Product ID: 0x00B9 (Basilisk V3 X HyperSpeed)
- Report Size: 90 bytes
- Command structure includes class, ID, and arguments with XOR checksum
- Permission Denied: Run with sudo for USB access
- Device Not Found: Ensure the mouse is connected via USB (not Bluetooth)
- USB Errors: Try unplugging and reconnecting the device
USB protocol implementation based on the OpenRazer project.