Configure a USB foot pedal (or remap any key) on Linux

I wanted a USB foot pedal solely for the purposes of push-to-talk (PTT) on Mumble, so I bought one and eventually got it working. Configuring any off-the-beaten-path device on Linux can be kind of a pain, but it does not always have to be. Hopefully this helps someone else with the same problem.

If you are really into it, you can build your own foot pedal or you can simply buy one for about $12 USD online. The pedal I bought was a just generic USB gaming foot pedal on Amazon, but there are fancier ones out there with multiple pedals as well, which we can address later on.

Essentially, the foot pedal will act as a USB keyboard with some kind of default key press. This should work the same for nearly every USB foot pedal, but the default key is not always ideal. In my case, the press was mapped to a lowercase b, which does not really help anyone. So the real fun to configuring this pedal is rebinding that key press to something else, exclusively for the foot pedal. If you are happy with your default foot pedal press, then you can stop here, otherwise let’s get to rebinding.

Note: For the entirety of this tutorial, I will be using my own unique values returned from various commands we will be using. I have done my best to note those values that you should replace with your own unique results. One other thing, we’re basically going over how to remap a key in Linux under the specific case for a USB foot pedal. You can use this tutorial to remap any key on any keyboard if you wish!

Once you have plugged in your foot pedal, we need to find out how the foot pedal is addressed by the operating system.

Looking down the list, I see a device that is probably my foot pedal,  Bus 006 Device 004: ID 0c45:7403 Microdia. We will need more information on it than that, so let’s go a little deeper.

Note the argument  -d 0c45:7403 here is my device ID that shows up in lsusb to limit the verbose output, which we widdle down to the just the parts we need.

Moving on, we need to find how the USB foot pedal is addressed as an input device so that we can remap it.

The results of  /lib/udev/findkeyboards tells us what’s plugged in and how we can address it specifically. I suspect that input/event11 is my device, so I will try that out with our next command. If you accidentily choose your primary keyboard, press ESC to get back to the command prompt.

There we can see the scan code that we detect when the foot pedal is pressed, in my case that was 0x70005. Quick note for those with a multiple pedal system, click each pedal individually and note which pedal corresponds to which scan code for later.

Alright, we’re almost there, but we’re about to get a little weird. Using your favorite editor as superuser, open up  /lib/udev/rules.d/95-keymap.rules.

At the bottom of the this file, we’re going to append a new line that is similar to the others, except with our new device’s configuration.

Very important note here, the ID_VENDOR  is set to our result from  lsusb before while the idProduct  matches the 0x7403  we got again from lsusb and it comes just before the line LABEL="keyboard_end" . This will very likely be different from your configuration, so be sure to substitute your unique values in here, as with the entirety of this tutorial.

Save and close the file. We now can remap the key press to something more palatable for PTT stuff on Mumble by creating a keymap file.

Using your favorite editor, create a new keymap file at /lib/udev/keymaps/microdia (substituting your LABEL  from before as the filename). In that new file, it is as simple as using the scan code we got before and the new key we want to map it to. In my case, I wanted to map it to the phantom F13  key, so that it never gets in the way.

Save and close the file, and we are basically done. Run the last command to get it up and running,

And we’re done! Note that you will need to reboot your machine for the change to be permanent, but otherwise you should be good.

If you have any problems, questions or suggestions, leave a comment!


  1. Thank you very much. You described almost my case. I had only trouble with udev rules. My switch has another ID_VENDOR but some ID_VENDOR_ID. Also it turned out that my 95-keymap.rules has sectioned structure.

    So I created file /etc/udev/rules.d/95-keymap.rules with below string and issue has fixed.
    “ENV{ID_VENDOR_ID}==”0c45″, ENV{ID_MODEL_ID}==”7403″, RUN+=”keymap $name microdia””


  2. Hi,

    first of all thanks for the detailed explanation, I’ve been using for my pedals about a year.

    Unfortunately in the latest version if Ubuntu (13.10) they seem to have changed how things work. /lib/udev/findkeyboards and /lib/udev/keymap are gone and I haven’t been able to figure out a replacement. Any ideas or pointers?


Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">