Cyborg V.7 volume bar on Linux

While playing with the Cyborg V.7 macro keys I though: how hard can it be to get the volume bar working on the keyboard as well? As it turns out, not too hard.

The big difference is that instead of reading what happens on USB, you'll actually need to write to USB to change the volume bar leds. So I started to play around with LibUSB, grabbed some scripts and monitored what windows did on my USB port when adjusting the volume bar via the "official" driver. 

The end result is a wee piece of C code that sends a signal to the relevant USB device (06a3:0728) and you're done. You can download the code here, untar it, go into the cyborg directory, run make and if all goes well you should have a binary called "cyborgLeds".

Just run this binary as root with a argument 0 to 20 and it'll change the volume bar on your keyboard: 

sudo /path/to/cyborgLeds 20

To run as root, add the following line to /etc/sudoers:

user ALL=NOPASSWD:/path/to/cyborgLeds [0-9]*

BTW, reverse engineering windows drivers actually became a lot easier with virtual machines. Get a windows VM up and running on a Linux box, attach the relevant USB device, start usbmon, use wireshark or just cat the usb device (cat /sys/kernel/debug/usb/usbmon/0u) to monitor what windows and the device are doing to each other.

Cyborg V.7 macro keys on Linux

I bumped into some scripts recently that nicely abuse usbmon to watch actions on USB devices and do stuff with it. And guess what, this works nicely to get the Cyborg V.7 macro keys to work under Linux! 

I wrote a little bash script ( which monitors all usb traffic for a certain pattern and if found sends out a Control+F1 to Control+F12 mapping to Xorg. Which allows you to map the macro keys in pretty much any application.

Unfortunately in order to actually monitor USB you'll need root access so you're probably best of to sudo the script on login. Just add the following line to /etc/sudoers:

user ALL=NOPASSWD:/path/to/cyborgMacros

Another shortcoming of the script is the fact that it monitors "usb device 0" which basically means all USB traffic is passed through this script (I'm guessing this could have quite a performance hit). This is just because I've been too lazy to add some keyboard detection in it... hopefully I'll get around to fix it sometime. 

Lastly it requires xdotool to be able to send the keyboard events to Xorg. I think it's included in most distro's but if not you might need to grab it yourself. 

Long story short, just start the script as root and off you go!

Cyborg V.7 and R.A.T. 7 on linux

So about a year ago I bought some new kit since my old keyboard and mouse were pretty much in the crapper. I'd been searching online for some cool, yet functional, stuff and ended up buying these little gems:

Both look pretty cool and work like a charm, or at least if you're running windows, install the drivers and dick around a bit. Linux however is, as usual, another story since it's apparently very hard for hardware vendors to write a driver for Linux. Having said that, it's not as bad as it seems, both are in the basics just normal input devices so they're support but with some limitations.

Let's start with the keyboard, obviously the normal keys work, and so do the special audio specific keys. As a matter of fact, because the cool stuff (aka game mode) is handled within the keyboard, this works perfectly as well. And the best feature of all is the fact that game mode disables the "Windows key"!

So what doesn't work then? Well you have 12 additional macro keys (C1 to C12) on the sides of the keyboard. Since Cyborg decided it was fun to require a driver for this, you're pretty much screwed under Linux (tho I did find a solution for this...). Then there is the cute volume bar on the keyboard which unfortunately also requires a driver to actually control this so, again you're fucked under Linux. However for normal usage this keyboard really works just fine under Linux, unless you want the macro keys and the volume bar to work. But again more on this later.

And what about the R.A.T. you ask? Well that works like a charm except for the fact that the (shitload of) extra buttons aren't mapped by default. Which is actually easily resolved by telling Xorg to map them. There's a bunch of instruction floating around on the Internet but obviously I chose to do my own mapping. 

Just open "/etc/X11/xorg.conf" and add the following section and off you go:

Section "InputClass"
   Identifier "R.A.T."
   MatchProduct "Saitek Cyborg R.A.T.7 Mouse"
   MatchDevicePath "/dev/input/event*"
   Option "Buttons" "17"
   Option "ButtonMapping" "1 2 3 4 5 6 7 8 9 10 11 12 0 0 0 16 17"
   Option "AutoReleaseButtons" "8 13 14 15"
   Option "ZAxisMapping" "4 5 10 11"

Concluding this is cool stuff and if you're considering buying it, do it! And if you're on Linux and you can live without the specials (for now), it's also definitely worth it.

More to come!

XHTML 1.1 valid CSS 3.0 valid JavaScript 1.6 valid Vivaldi valid Os-linux valid Ws-apache valid Php valid Jas valid