6

I'm trying to find out the scancodes for a set of foot pedals so that I can rebind them to more useful keys. In older versions of Ubuntu I was able to do this using /lib/udev/keymap as discussed here, but the program seems to no longer exist! Luckily I still know what the scancodes are for my specific hardware so I can still get everything working, but I want to write a post about how to set up foot pedals.

The arch-linux wiki suggests using showkey --scancodes but that seems to give me the wrong numbers (by comparing with the known, working scancodes that I'm currently using in my /etc/udev/hwdb.d/90-custom-keyboard.hwdb file):

                           hex        decimal
scancode used in config   0x70004      458756
showkey -s output         0x5d             91
xev keycode                               191

since it's similar to the X keycode I guess that X11 is interfering somewhere.

Is there an alternative way of finding the scancodes? Preferably one that doesn't involve using virtual consoles.

(This is a repost of a question I posted on superuser that no one was able to answer, I hope that's ok.)

8
  • Try xev. That should do it.
    – Seth
    Jun 11, 2014 at 14:48
  • xev only shows keycodes and keysyms as far as I can tell. I think scancodes are lower level than X.
    – dshepherd
    Jun 11, 2014 at 14:50
  • They are lower than X, but I thought xev showed both. I'm not on an Ubuntu machine at the moment, but I'll try to test it later.
    – Seth
    Jun 11, 2014 at 14:50
  • Any luck? I tried it out but I couldn't see anything that could be a scancode and I couldn't find any useful options.
    – dshepherd
    Jun 15, 2014 at 20:14
  • 3
    Note: This has been answered on Super User.
    – Doorknob
    Jan 20, 2015 at 1:55

1 Answer 1

2
sudo evtest

should give you a list of devices you can get scancodes for. One of them should have the foot pedal's name, so input the eventnumber you can see beside it. Then, once you use the pedal, you should see the scancode on the screen (after (MSC_SCAN), value). For example, here:

Testing ... (interrupt to exit)
Event: time 1413649733.746534, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70005
Event: time 1413649733.746534, type 1 (EV_KEY), code 48 (KEY_B), value 1

It's 70005.

source: Get keyboard scancodes in recent versions of linux

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .