I ordered USB foot pedal/button. Currently it outputs the letter "B" when pressed. How to make it act as the key "Enter"?
31 Answer
You should follow this guide: (this is a transcription of this documentation).
- find out how the foot pedal is addressed by the operating system with
lsusb, e.g.Bus 006 Device 004: ID 0c45:7403 Microdia - get more details with
lsusb -v -d 0c45:7403 | grep "idVendor|idProduct"where0c45:7403is the device ID that shows up in lsusb - find how the USB foot pedal is addressed as an input device so that we can remap it:
/lib/udev/findkeyboards(e.g.USB keyboard: input/event11) sudo /lib/udev/keymap -i input/event11(If you accidentily choose your primary keyboard, press ESC to get back to the command prompt.)- there you can see the scan code that is detected when the foot pedal is pressed, e.g.
0x70005 edit (sudo)
/lib/udev/rules.d/95-keymap.rulesto append:ENV{ID_VENDOR}=="Microdia", ATTRS{idProduct}=="0x7403", RUN+="keymap $name microdia" LABEL="keyboard_end"Very important note here, theID_VENDORis set to our result fromlsusbbefore while theidProductmatches the0x7403we got again fromlsusband it comes just before the lineLABEL="keyboard_end".create a new keymap file at
/lib/udev/keymaps/microdia(substituting yourLABELfrom before as the filename):0x70005 F13(Mapping the F13 to the pedal).- run the command to get it up and running:
sudo /lib/udev/keymap -i input/event11 /lib/udev/keymaps/microdia. Note that you will need to reboot your machine for the change to be permanent, but otherwise you should be good.
Hope it helps :)