USB foot pedal

wblock@

Developer
I've thought for quite a while that a foot pedal could be useful to trigger macros or as a keyboard shortcut. This morning at a yard sale, there was a transcription pedal. It looked old, but I checked the cable connector--it was USB! For the price of $1.50... why not? It is the one shown here: http://code.google.com/p/footpedal/.

To get it working, I used Thread 24069 as a guide.

The first step was to have devd(8) change permissions on the /dev/uhid0 device when it was attached. This was added to my devd(8) customizations file:
/etc/devd/wb.conf
Code:
# WB
# change permissions on foot pedal uhid device
attach 20 {
        device-name "uhid[0-9]";
        match "vendor" "0x05f3";
        match "product" "0x00ff";
        action "chmod g+w /dev/$device-name";
};
usbconfig -d 0.5 dump_device_desc was used to see the vendor and product IDs.

devd(8) must be restarted after changes:
# service devd restart

Next was to set up usbhidaction(1) to do what I wanted, which for a test was to type <acronym> when the left button is pressed, and </acronym> when the right button is pressed. (There is a lot of FreeBSD documentation with acronyms that still need these markup tags.)

~/usbhidaction.conf
Code:
# item (event)          value   debounce        action
Button:Button_1         1       0               xdotool type "<acronym>"
Button:Button_2         1       0               xdotool type "b"
Button:Button_3         1       0               xdotool type "</acronym>"

x11/xdotool is used to type these strings. "b" is just a placeholder for the large middle button.

To start usbhidaction(1):
usbhidaction -f /dev/uhid0 -c ~/usbhidaction.conf
 
Back
Top