I decided to rewrite most of the code in this old project to make it easier to add devices.
I also replaced all the code relating to opening usb devices.
Info #
This is a C program that sends the init code to initialize the 'macro' keys on Razer BlackWidow keyboards on Linux.
Linux users can then use the macro keys on their keyboard.
Changes #
Improvements #
- new code for opening usb devices
- array of keyboard device IDs
- new cli feedback
- support for more keyboards
Updating libusb Code #
I have been meaning to update the code to replace libusb_open_device_with_vid_pid()
libusb_open_device_with_vid_pid()
This function is intended for those scenarios where you are using libusb to knock up a quick test application
New Handle Code #
Use libusb_get_device_list() to check the device exists in the system before calling libusb_open() to open the connection.
libusb_get_device_list()
Returns a list of USB devices currently attached to the system.
This is your entry point into finding a USB device to operate.
libusb_open()
Open a device and obtain a device handle.
This is a non-blocking function; no requests are sent over the bus.
- Get USB Device List
- Check For Matching
venid&devid - Open Handle On Match
libusb: Device handling and enumeration
Adding More Devices #
The old code was a mess when it came to this.
I changed the way this was implemented so it now uses an array of known devices.
This makes it a lot easier to add support for more keyboards.
| ID | Device Name |
|---|---|
| 010D | Razer BlackWidow Ultimate |
| 010E | Razer BlackWidow |
| 011B | Razer BlackWidow 2013 |
| 0203 | Razer BlackWidow Chroma |
| 0221 | Razer BlackWidow Chroma V2 |
| 011A | Razer BlackWidow Ultimate 2014 |
Usage #
Razer BlackWidow Macro Keys v2.0
Sending Keyboard Macro Init Sequence for [1532:011b]
Sending data:
00 00 00 00 00 02 00 04
02 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
04 00
Transmitted: 90
Arguments:
-s send init packet
-v show verbose output
📝 January 23, 2016 - BlackWidow Macro Keys In Linux
📝 September 25, 2023 - Reset USB Device In Linux
Source Code #
The source for this project is available on github.
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.