Enabling Razer BlackWidow Macro / FN keys under Linux

Edit 2012-03-07: Like an idiot I forgot the call to detachKernelDriver() in the initialisation. The version below actually works, unlike the version I initially uploaded.

I recently purchased a Razer BlackWidow Ultimate keyboard to replace my ailing Alps switch based keyboard at home.

After purchasing a Das Keyboard Professional for work I felt confident in the tactile quality of the Cherry MX Blue keyswitches and so the BlackWidow Ultimate seemed like a good replacement (further given that it was actually available locally and on a Sunday; I bought mine at Global PC).

I had assumed that the "macro" keys would function like previous macro keyboards I've owned, where the macro functionality is entirely self contained within the keyboard, but it transpired after having a look with showkey and a quick flick through the manual that the BlackWidow was doing something more complex with the drivers.

Resigned to having to install Windows and fire up USB snoop I was happy to stumble upon tux_mark_5's Haskell implementation of the required USB control sequence on GitHub.

Unfortunately I couldn't get his code to compile (I am a Haskell noob and my Haskell build environment is broken in some esoteric way) so I decided to just port the code to Python / PyUSB.

I've added some other bits of polish to the code to make it a little friendlier for the user and released it in to the public domain below. At some point I will usbsnoop the Windows driver properly and write a proper Python class for controlling the macro LED as well as enabling the macro keys, until then you will have to make do with just the useful parts of the keyboard :)

Note: You will need the python-usb package and its associated dependencies to run this code on Debian or Ubuntu. Other distros will likely provide PyUSB and libusb in some form or other. You will probably need to be root in order to run the script successfully.

[ICO]NameLast modifiedSizeDescription

[DIR]Parent Directory  -  
[TXT]blackwidow_enable.py07-Mar-2012 22:13 2.9K 
[   ]blackwidow_enable.py.sig07-Mar-2012 22:14 287  

Apache Server at finch.am Port 80