All the geeky stuff that gets me hot.

Wednesday, May 02, 2007

Griffin Powermate working with Ubuntu Feisty Fawn

There are lots of linux programs that will interface with the Griffin Powermate. Since I want to customize the buttons on my keyboard and mouse as well as the Powermate I choose to use evrouter. Installing evrouter in Ubuntu can be done with apt-get or the synaptic package manager.

The kernel modules are already loaded in Ubuntu 7.04 to support the powermate so I didn't have to mess around with that. Run "evrouter -d /dev/input/event*" to make sure the powermate events are being received properly.

The first problem that needs to be solved is to assign a static name to the powermate with udev so it will always come up under the same device name. Normally it will come up under different device names depending on how it was plugged in.

Create the file /etc/udev/rules.d/10-local.rules and add this all on one line:
SUBSYSTEMS=="usb", ATTRS{product}=="Griffin PowerMate", KERNEL=="event?", NAME="input/powermate"
That will force the powermate to come up under /dev/input/powermate every time it's plugged in. Now we need to set permissions.

Create a group called "powermate" and add the correct users. Now edit /etc/udev/rules.d/40-permissions.rules and add this line at the bottom:
ATTRS{product}=="Griffin PowerMate" GROUP="powermate", MODE="0666"
Now the group powermate will have read permissions to the /dev/input/powermate device. Next we need to create the evrouter rules file. Create a file called .evrouterrc in your home directory and add this:
Window ""
"Griffin PowerMate" "" any key/256 "XKey/XF86AudioMute"
"Griffin PowerMate" "" any rel/7/1 "XKey/XF86AudioRaiseVolume"
"Griffin PowerMate" "" any rel/7/-1 "XKey/XF86AudioLowerVolume"
This is a very simple rules file that can be expanded to do other actions once you've got the powermate working. I'm adjusting the volume using Xserve commands since I want the powermate to control system volume but there are specific actions to control XMMS if you use that. The XF86 volume commands only work if they have been mapped to keys on your keyboard.

The last step is to configure evrouter to load at boot time. This is done in Ubuntu under preferences > sessions. Click new and give it a name of "EvRouter" and for the command enter "evrouter /dev/input/powermate". That will launch evrouter and tell it to listen to the powermate for events.

That's it, restart and you should have a functioning volume knob.