HOWTO Griffin PowerMate with UDEV and Kernel 2.6.x
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
[edit] Introduction
The following is instructions on how to get the Griffin PowerMate, a USB dial phydget (physical widget), to operate correctly in Gentoo (using kernel 2.6.x). These instructions should also work for pretty much any 2.6.x based distribution, the only complication being that the configuration file paths may be different.
[edit] Requirements
[edit] Preamble
Note that for most people most of the steps presented in this HOWTO will not be required. Most distributions will come with all of the necessary kernel modules compiled, so most people can jump directly to the section on Gizmo Daemon, which is a utility that will allow you to make full use of the PowerMate in Linux.
All of the following steps are presented so that any and all configuration issues should be able to be resolved.
[edit] Kernel
Make sure you have USB support in your kernel, the kernel option you should select will be either OHCI HCD or UHCI HCD, depending on your motherboard's chipset.
# cd /usr/src/linux
# make menuconfig
Device Drivers --->
USB support --->
<M> EHCI HCD (USB 2.0) support
< > OHCI HCD support
<M> UHCI HCD (most Intel and VIA) support
You must also enable the Griffin PowerMate driver, and the Event Interface driver:
Device Drivers --->
USB support --->
<M> Griffin PowerMate and Contour Jog support
Input device support --->
<M> Event interface
However in kernel versions 2.6.21 and newer, the PowerMate driver is moved under Input Device support:
Device Drivers --->
Input device support --->
[*] Miscellaneous devices --->
<M> Griffin PowerMate and Contour Jog support
If you have made any changes then save, compile the kernel modules, and install them:
# make modules && make modules_install
NOTE: I compiled the options as modules, if you wish you can compile them directly into the kernel instead. If you do this you will have to install the new kernel image, and reboot. Obviously this is beyond the scope of this document.
[edit] Hotplug
Hotplug must be told about the PowerMate, and a script created:
# cd /etc/hotplug/usb
Now create the following file:
| File: /etc/hotplug/usb/powermate.usermap |
powermate 0x0003 0x077d 0x0410 0x0000 0x0000 0x00 0x00 \
0x00 0x00 0x00 0x00 0x00000000
|
And the following script:
| Code: /etc/hotplug/usb/powermate |
#!/bin/bash LOGFILE="/var/log/hotplug/powermate" time=`date +"%b %d %X"` uname=`uname -n` echo "$time $uname $0: Griffin PowerMate Detected" >> $LOGFILE /sbin/rmmod evdev powermate /bin/sleep 1 /sbin/modprobe powermate /bin/sleep 1 /sbin/modprobe evdev echo "$time $uname $0: Griffin PowerMate Loaded" >> $LOGFILE |
Remember to point the LOGFILE variable to wherever you wish. If you want to leave it as it is make sure that the directory exists:
# mkdir /var/log/hotplug
Also, the script must be made executable:
# chmod +x /etc/hotplug/usb/powermate
[edit] UDEV
UDEV is a great improvement over devfs. For setup we need to create a rule for the PowerMate. We create a new file /etc/udev/rules.d/45-powermate.rules with the following content (has to be executed before 50-udev.rules, so the number must be <50):
| File: /etc/udev/rules.d/45-powermate.rules |
KERNEL=="event*", SYSFS{product}=="Griffin PowerMate", NAME="powermate", GROUP="input", MODE="0660"
|
This tells udev to look for an event device with a product name "Griffin PowerMate". If one is found, /dev/powermate is created with group "input" and access mode 0660. The properties of the corresponding /dev/input/eventX are also updated. If you want to use your powermate, you have to be in the input group. You can verify everything with
$ cat /dev/powermate
If you move your powermate, you should see weird characters on the screen.
[edit] New alternative
New alternative, dealing only with the powermate device:
Since the rules are sorted alphanumerically, make sure the name is beyond the standard 50-udev.rules:
| File: /etc/udev/rules.d/45-powermate.rules |
|
BUS="usb", KERNEL="event*", SYSFS{product}="Griffin PowerMate", SYMLINK="powermate"
|
The standard udev rule creates a device like /dev/input/event3 and since our rules file has been read previously, it creates a symlink called /dev/powermate, too. After device and symlink creation, udev sets an environment variable $DEVPATH to something like "/class/input/event3" and calls a program in /etc/dev.d, presumely /etc/dev.d/default/05-pam_console.dev. This script sets the permissions on the newly created devicenode and the symlink according to the system definitions in /etc/security/console.perms and the .perms files in the subdirectory /etc/security/console.perms.d/
We create a new file:
| File: /etc/security/console.perms.d/45-powermate.perms |
|
<powermate>=/dev/powermate
<console> 0600 <powermate> 0600 root
|
This sets the owner of the device "powermate" to the user logged in at the console or xconsole and giving him/her write access to the device. I think that's the cleanest solution, because it works regardlessly whether the PowerMate is being hotplugged or present at boot-time/log-in time. Additionally it restricts access to the powermate to the user logged in, as there are no group permissions. (The above mentioned group permissions, e.g. "input" would allow any user in this group to access the device, even if remotely logged in.)
[edit] Sowerbutt's Userland Utilities
Get the PowerMate Userland Software (PowerMate uber-basic userspace tools). We will use this to verify that the PowerMate is installed correctly.
[edit] Gizmo Daemon
Gizmo Daemon is a highly flexible utility for allowing input devices to interact with the computer. It has out of the box support for the Griffin PowerMate and has some very cool features. For example, it can visualize certain system events on the Powermate's LED such as system volume, CPU usage, and music output via the Amarok visualization plugin that lets you visualize music on any LED capable device (such as the PowerMate, or even your keyboard LEDs).
By default Gizmo Daemon will let you control various applications with your PowerMate, and has support for FireFox, the Beryl window manager, MythTV, mplayer, and others, but Gizmo Daemon also has a well designed Python scripting API that allows for easy creation of new application mappings.
Get the latest Gizmo Daemon source and Ubuntu packages here. Gizmo Daemon is also available in the official Gentoo Sunrise overlay. Instructions on how to install Gizmod from Sunrise are here.
After installing Gizmo Daemon, jump to the section on running Gizmo Daemon. However, most people will simply need run run gizmod:
# gizmod &
You should now be able to make full use of your PowerMate in Linux!
Note that Gizmod has an active user community and a very useful wiki. It is a very powerful program that allows you to completely customize how your PowerMate controls applications and interacts with the computer -- for more information peruse the wiki.
[edit] Checking the installation
First, restart hotplug, and udev:
# /etc/init.d/hotplug restart
# udevstart
Now, unplug the PowerMate, and plug it back in. Then, run dmesg, and see what output it gives. On my system I see the following:
input: Griffin PowerMate on <NULL> usbcore: registered new driver powermate
Obviously the first line isn't quite correct. I have been unable to resolve this issue with 2.6.x, and UDEV, so if someone has an answer, please update this document. But, the good news is, it's not going to stop us from using the PowerMate.
If the hotplug and UDEV configurations went according to plan something akin to the following lines should be seen in your powermate log file:
# cat /var/log/hotplug/powermate
| File: /var/log/hotplug/powermate |
Jan 03 09:04:34 SpaceDolphin /etc/hotplug/usb/powermate: Griffin PowerMate Detected Jan 03 09:04:34 SpaceDolphin /etc/hotplug/usb/powermate: Griffin PowerMate Loaded |
[edit] Running the Userland utilities
First let's unpack and compile them:
# tar zxvf powermate-1.0.tgz
# cd powermate-1.0
# make
There should now be two shiny new executables: pulseled, and rotomatic.
Let's try out the rotomatic:
# ./rotomatic
It will scan /dev/input/event* for the correct device. You should be able to jog the dial at this point, and the program will spit out events:
Button was rotated 1 units; Offset from start is now 1 units Warning: unexpected event type; ev->type = 0x0000 Button was rotated 1 units; Offset from start is now 2 units Warning: unexpected event type; ev->type = 0x0000
Good! We're ready to do something useful now!
[edit] Gizmo Daemon
All that's left is to launch Gizmo Daemon!
# gizmod
Gizmod can be run in debug mode, which will print out all the input events it receives:
# gizmod -g
For more help with using and running gizmod, see the Gizmo Daemon wiki.
[edit] References and Links
The Gizmo Daemon userland utility for controlling and making use of various input devices, including the Griffin PowerMate.
Special thanks to Sowerbutts for the original kernel driver, and userland utils.
Also thanks to Zonawiki for his excellent resources on using the PowerMate in Linux. Check this page for some great source code.

