<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="http://catswhisker.xyz/">
  <id>http://catswhisker.xyz/</id>
  <title>Atom Feed for 'linux' Articles</title>
  <updated>2026-02-08T16:33:06Z</updated>
  <link rel="alternate" href="http://catswhisker.xyz/" type="text/html"/>
  <link rel="self" href="http://catswhisker.xyz/tags/linux/atom.xml" type="application/atom+xml"/>
  <author>
    <name>A. Cynic</name>
    <uri>http://catswhisker.xyz/about/</uri>
  </author>
  <entry>
    <id>tag:catswhisker.xyz,2018-08-28:/log/2018/8/27/use_vecinfinity_usb_foot_pedal_as_a_keyboard_under_linux/</id>
    <title type="html">Use VEC/Infinity USB Foot Pedal as a Keyboard Under Linux</title>
    <published>2018-08-28T02:34:00Z</published>
    <updated>2026-02-08T16:33:06Z</updated>
    <link rel="alternate" href="http://catswhisker.xyz/log/2018/8/27/use_vecinfinity_usb_foot_pedal_as_a_keyboard_under_linux/" type="text/html"/>
    <content type="html">&lt;div class="paragraph"&gt;
&lt;p&gt;I own a 3-switch USB foot pedal that looks like this:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="imageblock"&gt;
&lt;div class="content"&gt;
&lt;img src="/log/2018/8/27/use_vecinfinity_usb_foot_pedal_as_a_keyboard_under_linux/pedal.jpeg" alt="Photo of Infinity IN-USB-1 foot pedal"&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;This is how I got it working under Linux so that I can assign any keysym to each button which I can then bind to functions in my window manager or programs as I see fit.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;(It is unintuitive to me that the left pedal is marked FWD and the right REW, but it doesn&amp;#8217;t matter since we will map them to whatever function we want.)&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;I&amp;#8217;m unsure of its ancestry, but the label on the back of my pedal says &amp;#8220;Infinity IN-USB-1&amp;#8221; and I&amp;#8217;ve seen newer pedals online called IN-USB-2 which have a different case but as far as I can tell provide an identical interface (same idVendor and idProduct, same scancodes).
The In-USB-2 and Infinity USB-3 pedals, by &lt;a href="http://www.veccorp.com/foot-controls.html"&gt;VEC Electronics&lt;/a&gt;, also seem to be the same as some of the &lt;a href="https://xkeys.com/xkeys/footpedals.html"&gt;X-keys pedals&lt;/a&gt; sold by P.I. Engineering.
So this guide should apply to any of them, and a similar process will likely work to get other USB foot pedals setup.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;For more direct, less detailed instructions on getting your VEC footpedal to work, see &lt;a href="http://gkarsay.github.io/parlatype/footpedals/footpedals.html"&gt;the Parlatype documentation on footpedals&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="sect1"&gt;
&lt;h2 id="_evdev"&gt;evdev&lt;/h2&gt;
&lt;div class="sectionbody"&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;When I plug my pedal in, &lt;code&gt;dmesg&lt;/code&gt; reports the following information:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight nowrap"&gt;&lt;code data-lang="sh"&gt;[81924.859319] usb 10-1: new low-speed USB device number 25 using uhci_hcd
[81925.261424] usb 10-1: New USB device found, idVendor=05f3, idProduct=00ff
[81925.261427] usb 10-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[81925.261429] usb 10-1: Product: VEC USB Footpedal
[81925.261431] usb 10-1: Manufacturer: VEC
[81925.275747] input: VEC  VEC USB Footpedal as /devices/pci0000:00/0000:00:1d.2/usb10/10-1/10-1:1.0/0003:05F3:00FF.0022/input/input41
[81925.276084] hid-generic 0003:05F3:00FF.0022: input,hiddev0,hidraw4: USB HID v1.00 Device [VEC  VEC USB Footpedal] on usb-0000:00:1d.2-1/input0&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;This is a good sign. Already we see the vendor ID (05F3) and product ID (00FF), which we will use to match the device in udev rules, and udev recognizes it as &amp;#8220;VEC USB Footpedal&amp;#8221;.
The kernel&amp;#8217;s HID driver seems to recognize it as an input device and exposes its events as a character device via &lt;a href="https://en.wikipedia.org/wiki/Evdev"&gt;evdev&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Sure enough, running &lt;code&gt;evtest&lt;/code&gt; (in debian: &lt;code&gt;apt install evtest&lt;/code&gt;) sees it and shows the &lt;code&gt;/dev/input/eventX&lt;/code&gt; node it was assigned:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;...
/dev/input/event4:      VEC  VEC USB Footpedal
...&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;In my case it is &lt;code&gt;event4&lt;/code&gt; (this will differ depending on how many input devices you have plugged in), and choosing &lt;code&gt;4&lt;/code&gt; from the &lt;code&gt;evtest&lt;/code&gt; prompt then pressing the foot pedal switches shows that it is detecting the events!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock wide"&gt;
&lt;div class="title"&gt;Output of &lt;code&gt;$ evtest&lt;/code&gt; after pressing and releasing each pedal from left to right&lt;/div&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;Event: time 1535305153.576554, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1535305153.576554, type 1 (EV_KEY), code 256 (BTN_0), value 1
Event: time 1535305153.576554, -------------- SYN_REPORT ------------
Event: time 1535305153.696549, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1535305153.696549, type 1 (EV_KEY), code 256 (BTN_0), value 0
Event: time 1535305153.696549, -------------- SYN_REPORT ------------
Event: time 1535305154.224555, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1535305154.224555, type 1 (EV_KEY), code 257 (BTN_1), value 1
Event: time 1535305154.224555, -------------- SYN_REPORT ------------
Event: time 1535305154.352584, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1535305154.352584, type 1 (EV_KEY), code 257 (BTN_1), value 0
Event: time 1535305154.352584, -------------- SYN_REPORT ------------
Event: time 1535305155.992658, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1535305155.992658, type 1 (EV_KEY), code 258 (BTN_2), value 1
Event: time 1535305155.992658, -------------- SYN_REPORT ------------
Event: time 1535305156.136669, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1535305156.136669, type 1 (EV_KEY), code 258 (BTN_2), value 0
Event: time 1535305156.136669, -------------- SYN_REPORT ------------&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;From this output we can see the scancodes sent by each pedal switch, and the default keycodes they are translated to by the kernel (by default they act like the left, middle, and right mouse buttons).&lt;/p&gt;
&lt;/div&gt;
&lt;table class="tableblock frame-all grid-all stretch"&gt;
&lt;caption class="title"&gt;Table 1. Summary of default scancodes and keycodes sent by the pedal&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col style="width: 33.3333%;"&gt;
&lt;col style="width: 33.3333%;"&gt;
&lt;col style="width: 33.3334%;"&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th class="tableblock halign-left valign-top"&gt;Pedal&lt;/th&gt;
&lt;th class="tableblock halign-left valign-top"&gt;Scancode (hex)&lt;/th&gt;
&lt;th class="tableblock halign-left valign-top"&gt;Keycode&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;Left&lt;/p&gt;&lt;/td&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;90001&lt;/p&gt;&lt;/td&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;&lt;code&gt;BTN_0&lt;/code&gt; (left mouse button)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;Center&lt;/p&gt;&lt;/td&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;90002&lt;/p&gt;&lt;/td&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;&lt;code&gt;BTN_1&lt;/code&gt; (middle mouse button)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;Rightt&lt;/p&gt;&lt;/td&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;90003&lt;/p&gt;&lt;/td&gt;
&lt;td class="tableblock halign-left valign-top"&gt;&lt;p class="tableblock"&gt;&lt;code&gt;BTN_2&lt;/code&gt; (right mouse button)&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;So it seems to work out-of-the-box, with only two issues:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="olist arabic"&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;
&lt;p&gt;Even though the kernel sees the pedal, it is invisible to Xorg and the programs I actually want to use with it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Having it act like mouse buttons is not very useful; I want to re-map its keysyms to something I can use as hotkeys.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="sect1"&gt;
&lt;h2 id="_xorg"&gt;Xorg&lt;/h2&gt;
&lt;div class="sectionbody"&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Pressing the pedals has no apparent effect under X.
Running &lt;code&gt;xev&lt;/code&gt; and pushing the switches also has no effect.
It is not included in the output of &lt;code&gt;libinput list-devices&lt;/code&gt;&amp;#8201;&amp;#8212;&amp;#8201;Xorg is simply not seeing the footpedal as in input device.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;One slight frustration is that manually running &lt;code&gt;udevadm trigger&lt;/code&gt; allows X to see the pedal, but after unplugging and plugging it back in results in it once again being ignored.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The problem is that udev is not tagging the pedal as a keyboard or a mouse when it is added during the hotplug event, so X is ignoring it.
This can be seen by running the &lt;code&gt;udevadm info&lt;/code&gt; tool:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title"&gt;Output of &lt;code&gt;$ udevadm info /dev/input/event&lt;/code&gt;&lt;/div&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight nowrap"&gt;&lt;code data-lang="sh"&gt;udevadm info /dev/input/event4
P: /devices/pci0000:00/0000:00:1d.2/usb10/10-1/10-1:1.0/0003:05F3:00FF.0022/input/input41/event4
N: input/event4
S: input/by-id/usb-VEC_VEC_USB_Footpedal-event-if00
S: input/by-path/pci-0000:00:1d.2-usb-0:1:1.0-event
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1d.2-usb-0:1:1.0-event /dev/input/by-id/usb-VEC_VEC_USB_Footpedal-event-if00
E: DEVNAME=/dev/input/event4
E: DEVPATH=/devices/pci0000:00/0000:00:1d.2/usb10/10-1/10-1:1.0/0003:05F3:00FF.0022/input/input41/event4
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_MODEL=VEC_USB_Footpedal
E: ID_MODEL_ENC=VEC\x20USB\x20Footpedal
E: ID_MODEL_ID=00ff
E: ID_PATH=pci-0000:00:1d.2-usb-0:1:1.0
E: ID_PATH_TAG=pci-0000_00_1d_2-usb-0_1_1_0
E: ID_REVISION=0100
E: ID_SERIAL=VEC_VEC_USB_Footpedal
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=VEC
E: ID_VENDOR_ENC=VEC\x20
E: ID_VENDOR_ID=05f3
E: LIBINPUT_DEVICE_GROUP=3/5f3/ff:usb-0000:00:1d.2-1
E: MAJOR=13
E: MINOR=68
E: SUBSYSTEM=input
E: USEC_INITIALIZED=81926725812&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The device has the &lt;code&gt;ID_INPUT&lt;/code&gt; tag, but no &lt;code&gt;ID_INPUT_KEYBOARD&lt;/code&gt; or &lt;code&gt;ID_INPUT_MOUSE&lt;/code&gt; tag which Xorg&amp;#8217;s evdev/libinput drivers look for.
(For some details on how udev decides what is a keyboard or mouse, see Matt Fischer&amp;#8217;s &lt;a href="https://web.archive.org/web/20220127032931/https://www.mattfischer.com/blog/archives/182"&gt;&amp;#8220;How Does udev Know What’s a Keyboard or Mouse?&amp;#8221;&lt;/a&gt;)
Luckily the fix is a simple one-line udev rule file (thanks to &lt;a href="https://gkarsay.github.io/parlatype/"&gt;Parlatype&lt;/a&gt; developer Gabor Karsay for providing this solution in &lt;a href="https://github.com/gkarsay/parlatype/issues/28"&gt;Parlatype Issue 28&lt;/a&gt;):&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title"&gt;/etc/udev/rules.d/10-vec-usb-footpedal.rules&lt;/div&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;event[0-9]*&amp;quot;, ATTRS{idVendor}==&amp;quot;05f3&amp;quot;, ATTRS{idProduct}==&amp;quot;00ff&amp;quot;, ENV{ID_INPUT_KEYBOARD}=&amp;quot;1&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Create a file called &lt;code&gt;/etc/udev/rules.d/10-vec-usb-footpedal.rules&lt;/code&gt; containing that line.
No need to run any command to refresh udev, the new file should automatically be detected.
Now whenever the foot pedal is plugged in, it will be given the &lt;code&gt;ID_INPUT_KEYBOARD=1&lt;/code&gt; tag and Xorg/libinput will use it as an input device!&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="sect1"&gt;
&lt;h2 id="_remapping_keysyms_with_udev_hwdb"&gt;Remapping keysyms with udev hwdb&lt;/h2&gt;
&lt;div class="sectionbody"&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Having three extra mouse buttons to use with my foot is not very useful to me.
We will fix this with a udev &lt;a href="https://www.freedesktop.org/software/systemd/man/hwdb.html"&gt;hwdb&lt;/a&gt; file.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Create a file under &lt;code&gt;/etc/udev/hwdb.d/&lt;/code&gt; (I put mine in &lt;code&gt;/etc/udev/hwdb.d/60-usb-footpedal.hwdb&lt;/code&gt;) containing these lines:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="title"&gt;/etc/udev/hwdb.d/60-usb-footpedal.hwdb&lt;/div&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;evdev:input:b*v05F3p00FF*
 KEYBOARD_KEY_90001=f14
 KEYBOARD_KEY_90002=f15
 KEYBOARD_KEY_90003=f16&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="admonitionblock note"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td class="icon"&gt;
&lt;i class="fa icon-note" title="Note"&gt;&lt;/i&gt;
&lt;/td&gt;
&lt;td class="content"&gt;
This syntax is good for udev version 220 and later. Make sure to capitalize the hexadecimal Vendor and Product IDs.
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;This time we do need to inform the system to update the binary hwdb file:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;$ sudo systemd-hwdb update&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;And then unplug and replug the device (or run &lt;code&gt;sudo udevadm trigger&lt;/code&gt; to re-trigger udev rules).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The first line of the hwdb file matches our device (vendor 05F3, product 00FF), and the subsequent lines map a scancode (hex) to a keycode.
I chose the F14, F15, and F16 function keys, but a list of available keycodes is defined in &lt;a href="https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h"&gt;/usr/include/linux/input-event-codes.h&lt;/a&gt;; to use the names #defined in that file as hwdb keycodes, simply convert them to lowercase and remove the &lt;code&gt;key_&lt;/code&gt; prefix.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The comments at the top of the system-wide configuration file contain some documentation: &lt;a href="https://github.com/systemd/systemd/blob/master/hwdb.d/60-keyboard.hwdb"&gt;/lib/udev/hwdb.d/60-keyboard.hwdb&lt;/a&gt;
And for more generic instructions on using udev to remap keys, see Kim Jongyul&amp;#8217;s &lt;a href="https://yulistic.gitlab.io/2017/12/linux-keymapping-with-udev-hwdb/"&gt;&amp;#8220;Linux keymapping with udev hwdb.&amp;#8221;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The default (pc+us) xkb keyboard layout on my computer maps &lt;code&gt;F14&lt;/code&gt;, &lt;code&gt;F15&lt;/code&gt;, and &lt;code&gt;F16&lt;/code&gt; to the &lt;code&gt;XF86Launch5&lt;/code&gt;, &lt;code&gt;XF86Launch6&lt;/code&gt;, and &lt;code&gt;XF86Launch7&lt;/code&gt; keysyms, respectively.
Using those keysyms, each pedal switch can be mapped as a hotkey in your desktop or window manager.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="sect1"&gt;
&lt;h2 id="_use_new_function_keys_with_vim"&gt;Use new function keys with Vim&lt;/h2&gt;
&lt;div class="sectionbody"&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Unfortunately not all programs can bind to arbitrary keysyms like the XF86* keys.
A list of keys available to vim, for example, can be found at &lt;a href="http://vimdoc.sourceforge.net/htmldoc/term.html#t_ku"&gt;:h t_ku&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;One solution is to use &lt;code&gt;xmodmap&lt;/code&gt; to map the keycodes to the actual &lt;code&gt;F14&lt;/code&gt;, &lt;code&gt;F15&lt;/code&gt;, and &lt;code&gt;F16&lt;/code&gt; keysyms.
Use &lt;code&gt;xev&lt;/code&gt; to find out what keycode X is seeing for each pedal.
Here&amp;#8217;s example output from the left pedal:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;KeyPress event, serial 34, synthetic NO, window 0x400001,
    root 0x439, subw 0x0, time 154723303, (340,452), root:(1051,943),
    state 0x10, keycode 192 (keysym 0x1008ff45, XF86Launch5), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The thing to note is the &amp;#8220;keycode&amp;#8221; is 192.
Then to remap the keysyms:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;$ xmodmap -e &amp;quot;keycode 192 = F14&amp;quot;
$ xmodmap -e &amp;quot;keycode 193 = F15&amp;quot;
$ xmodmap -e &amp;quot;keycode 194 = F16&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;I put these commands in my &lt;code&gt;.xsession&lt;/code&gt; file so they run every time I log in to X.
Key autorepeating can be supressed (so that you can leave your foot on the pedal without it triggering more key presses) with the &lt;code&gt;xset&lt;/code&gt; command:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="sh"&gt;$ xset -r 193&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;The disadvantage of simply placing &lt;code&gt;xmodmap&lt;/code&gt;/&lt;code&gt;xset&lt;/code&gt; commands in the &lt;code&gt;.xsession&lt;/code&gt; file is that they need to be re-run every time the pedal is unplugged.
One solution would be to use a udev rule to run a script containing those &lt;code&gt;xmodmap&lt;/code&gt; commands every time the pedal is plugged back in.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Both gvim and neovim now see the function keys and you can map them as normal:&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="vim"&gt;inoremap &amp;lt;F15&amp;gt; Middle pedal&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;But depending on your terminal settings, vim in the console probably still does not recognize the keys.
To fix it, set vim&amp;#8217;s keycodes to whatever escape sequence your terminal sends for each pedal (in insert mode type Ctrl-Q then hit the pedal).&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;I have these lines in my .vimrc file, which allows me to map &lt;code&gt;F14&lt;/code&gt; et al. in vim (gvim and neovim ignore these settings):&lt;/p&gt;
&lt;/div&gt;
&lt;div class="listingblock"&gt;
&lt;div class="content"&gt;
&lt;pre class="CodeRay highlight"&gt;&lt;code data-lang="vim"&gt;&amp;quot; Map higher F keys to codes sent by libvte
&amp;quot; The escape codes are literal:
&amp;quot; type Ctrl-q then press the footpedal switch
set &amp;lt;F14&amp;gt;=^[[26~
set &amp;lt;F15&amp;gt;=^[[28~
set &amp;lt;F16&amp;gt;=^[[29~&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Success at last!&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;For some background on terminal escape codes for function keys see Phil Gold&amp;#8217;s &lt;a href="http://aperiodic.net/phil/archives/Geekery/term-function-keys.html"&gt;&amp;#8220;Terminal Function Key Escape Codes&amp;#8221;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;For anyone planning on transcribing audio in neovim, I recently came across this plugin for controlling the playback of audio: &lt;a href="https://github.com/gaalcaras/transcribe.nvim"&gt;gallcaras/transcribe.nvim&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="sect1"&gt;
&lt;h2 id="_other_options"&gt;Other options&lt;/h2&gt;
&lt;div class="sectionbody"&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;A Python program called &lt;a href="https://sourceforge.net/projects/footcontroller/"&gt;footcontroller&lt;/a&gt; by &lt;a href="https://sourceforge.net/u/rolfofsaxony/profile/"&gt;rolfofsacony&lt;/a&gt; reads events from the evdev device (&lt;code&gt;/dev/input/eventX&lt;/code&gt;) and can be configured to issue key strokes (via &lt;a href="https://github.com/jordansissel/xdotool"&gt;xdotool&lt;/a&gt;) or run scripts in response to stepping on the pedals.
The program allows for configuring several sets of commands and switching between them (so you can use your foot pedal for different purposes: transcription, controlling your media player, to launch apps, to exit vim, etc.)
The user manual for the program includes several examples and instructions for switching between command sets using hotkeys.
Footcontroller can be used in lieu of the xmodmap step above.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;In addition to the evdev device, the kernel&amp;#8217;s HID driver also creates a &lt;a href="https://github.com/torvalds/linux/blob/master/Documentation/hid/hiddev.rst"&gt;hiddev&lt;/a&gt; node (&lt;code&gt;/dev/usb/hiddevX&lt;/code&gt;) which provides a more raw interface to the pedal state.
Here is a C program which reads the HID node to handle pedal events; it includes a sample program to control mplayer using the pedal: &lt;a href="https://github.com/squires/infinity-pedal"&gt;infinity-pedal driver&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Because the pedal is an HID device, it should be possible to write a cross-platform program to read it using something like &lt;a href="http://www.signal11.us/oss/hidapi/"&gt;HIDAPI&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="sect2"&gt;
&lt;h3 id="_mac_os_x"&gt;Mac OS X&lt;/h3&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;P.I. Engineering provides software that works with their devices (including the IN-USB-1 and IN-USB-2 foot pedals): &lt;a href="https://xkeys.com/support.html"&gt;Software for X-keys&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="paragraph"&gt;
&lt;p&gt;Most impressive is a GUI program called ControllerMate by OrderedBytes, which provides a powerful graphical scripting language for triggering actions from input devices.
Best of all is they offer &lt;a href="https://www.orderedbytes.com/controllermate/xkeys/"&gt;a free version especially for X-keys devices&lt;/a&gt; which works with our pedal.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content>
    <summary type="html">How to get a VEC USB (Infinity "IN-USB-1" or "IN-USB-2") foot controller to work under linux.</summary>
  </entry>
</feed>

