USB Foot Pedal or Switch as a Keyboard in Linux

I have been full-time at a standing desk for almost two years now. Except in long meetings (which happens rarely), I don't sit. I wondered if I could do more with my feet than just standing. What if I could use a foot pedal? Some use cases could be scrolling up/down, muting/unmuting in a meeting, pausing/continuing in OBS, etc.

Foot pedal by Sanguine

Finally, I got a foot pedal from Sanguine, a Coimbatore-based company that makes them for medical transcription. I was a little hesitant about the support. But their website mentioned VEC USB, which made me a bit confident. So I ordered one. VEC is a foot pedal manufacturer from US. They are quite popular and is supported on almost all OSes. I just assumed Saguine is probably manufacturing a compatible hardware.

One of their support people called me the next day to confirm. He called me so he could preconfigure the pedal for a specific medical transcription software. He was curious about my use case, we had a bit of chat, and then he thought it was better to send an unconfigured one. So I can configure it. Finally, the configuring and setup were straightforward, like in this guide

Brochure on http://sanguineparc.com

Plug the pedal into USB drive and see if your computer recognizes it.

# List the usb devices
$ lsusb
# It should output the below line if its identified as Footpedal
# Bus 001 Device 027: ID 05f3:00ff PI Engineering, Inc. VEC Footpedal

If not check the device logs for the as soon as you connect it, using dmesg. This should product and manufacturer details. If not it will show the error logs that you can debug. In my case since it was identified, all is well.

$ dmesg
# It should out out the product and manufacturer details. Like this

#usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
#usb 1-1.1: Product: VEC USB Footpedal
#usb 1-1.1: Manufacturer: VEC
#input: VEC VEC USB Footpedal as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:05F3:00FF.000A/input/input123
#hid-generic 0003:05F3:00FF.000A: input,hiddev1,hidraw4: USB HID v1.00 Device [VEC VEC USB Footpedal] on usb-0000:00:14.0-1.1/input0

As you can see in the above logs kernal has identified it as input device and HID. So far good. Now we will we check if it triggers evdev events using evtest

evdev (short for 'event device') is a generic input event interface in the Linux kernel and FreeBSD.[1] It generalizes raw input events from device drivers and makes them available through character devices in the /dev/input/ directory.

Wikipedia

You will have to install evtest if its not already there sudo apt-get install evtest should work on Ubuntu. If you can call evtest then it will display all the devices. From it pickup the device id and and then live query it.

evtest - Input device event monitor and query tool

The first invocation type displayed above ("capture mode") causes evtest to display information about the specified input device, including all the events supported by the device. It then monitors the device and displays all the events layer events generated.

In the second invocation type ("query mode"), evtest performs a one-shot query of the state of a specific key value of an event type.

nanpages
Testing using the evtest

Crete a udev rule by creating the file /etc/udev/rules.d/10-vec-usb-footpedal.rules and adding the below lines. This will get automatically picked up

ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{idVendor}=="05f3", ATTRS{idProduct}=="00ff", ENV{ID_INPUT_KEYBOARD}="1"

Then we need to add this device to hardware db of the machine. For that you will need to create a file /etc/udev/hwdb.d/60-usb-footpedal.hwdb and then add

evdev:input:b*v05F3p00FF*
 KEYBOARD_KEY_90001=f14
 KEYBOARD_KEY_90003=f16

You will need to update the system by running

sudo systemd-hwdb update

On a standard default keyboard, this will map F14 to Launch6 and F16 to Launch7. You can use system keymapper to map any shortcut you want. Below you can see that I have added "Launch web browser" shortcut to right button. You can configure any other shortcut too. It's left to your creativity.

As you can see I have followed the steps exactly like in VEC/Infinity USB Foot Pedal as a Keyboard Under Linux and it works. A big thanks to them.


You can read this blog using RSS Feed. But if you are the person who loves getting emails, then you can join my readers by signing up.

Join 2,245 other subscribers

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.