I have been using a Mac Razer Anasi at work, the macro keys are great but alone the keyboard is amazing to type on. I bought the windows version to use with Linux knowing full well it wouldn't work. I had already tested the Mac version and done some research, no one smarter than me had figured out how the razer drivers trigger changing the macro keys from really standard key codes like = - 0 9 8 and various other hard to map keys because mapping them would make much of the keyboard unusable. I had been watching this post on SuperUser http://superuser.com/questions/342107/getting-macro-keys-from-a-razer-blackwidow-to-work-on-linux and there were some good ideas, I was going to use this as a starting point to try and figure out how it all worked. Well someone else beat me too it and I'm glad they did, looking at what they did I don't know if I would have easily figured it out. Basically a command can be sent to the keyboard to change the scan code for each keyboard macro key. So following the instructions from SuperUser and using some of the information learned with the Logitech Trackpad we can assign any of the macro buttons.
First install cabal, ghc and libusb
sudo pacman -S cabal-install ghc libusb
Now we need to update cabal and install the usb module
cabal update; cabal install usb
now clone the git repository for EnableRazer
git clone git://github.com/tuxmark5/EnableRazer.git
I'm using the Anasi so the product ID needs to be changed in Main.hs
gedit src/Main.hs
line 64 is where the product ID goes, use lsusb to find the id of your ID, first part should be 1532 because that is Razers company ID. Its a small program so building and configureing EnableRazer is very quick.
cd EnableRazer/; cabal configure; cabal build
copy the binary to somewhere in your path, I used /usr/local/sbin because it is locally built and root is required to run
sudo cp dist/build/EnableRazer/EnableRazer /usr/local/sbin/
and run it
sudo EnableRazer
this should give you this output
WRITING SET_REPORT
OK
now use xev to see the changes, the t2, t3 and t4 will need to be remapped using udev because they default to trackad toggle, trackpad on and trackpad off. They don't work do anything useful and every easy way of remmaping did not work.
Boy, you saved my day.
ReplyDeleteI am also using Archlinux and have a Razer Anansi keyboard.
I was despairing of getting usable keycodes on the extra keys, but the described method did it.
Thank you !
Mektub
If you happen to be on Ubuntu 14 or 16 and encounter build issues, https://github.com/tuxmark5/EnableRazer/issues/5
ReplyDeleteI am wondering if this would work with a Razer Naga Chroma mouse with 12 side-buttons??
ReplyDelete