๐Ÿ“ฆ DeflateAwning / vec-footpedal-hid-linux

A quick and dirty implementation of mapping for a VEC footpedal HID device on Linux

โ˜… 1 stars โ‘‚ 1 forks ๐Ÿ‘ 1 watching โš–๏ธ MIT License
๐Ÿ“ฅ Clone https://github.com/DeflateAwning/vec-footpedal-hid-linux.git
HTTPS git clone https://github.com/DeflateAwning/vec-footpedal-hid-linux.git
SSH git clone git@github.com:DeflateAwning/vec-footpedal-hid-linux.git
CLI gh repo clone DeflateAwning/vec-footpedal-hid-linux
DeflateAwning DeflateAwning Update README.md 609eb9e 2 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“„ .gitignore
๐Ÿ“„ LICENSE
๐Ÿ“„ README.md
๐Ÿ“„ requirements.txt
๐Ÿ“„ vec-footpedal.py
๐Ÿ“„ README.md

vec-footpedal-hid-linux

A quick and dirty implementation of mapping for a VEC footpedal HID device on Linux

Features

  • Allows remapping of a VEC footpedal to any keys/mouse events.
  • Automatically finds the footpedal. Automatically reconnects on disconnection.
  • Doesn't require sudo, if you follow these instructions.

Contributions

  • Open PRs and GitHub Issues as you wish!

Setup/Usage

  • Set permissions so you don't need to run as sudo.
  • sudo nano /etc/udev/rules.d/40-footpedal-hid.rules
  • Paste in the following contents.
SUBSYSTEM=="usb", SYSFS{idVendor}=="05f3", MODE="0666"
		SUBSYSTEM=="usb", ATTRS{idVendor}=="05f3", MODE="0666"
		SUBSYSTEM=="input", SYSFS{idVendor}=="05f3", MODE="0666"
		SUBSYSTEM=="input", ATTRS{idVendor}=="05f3", MODE="0666"
  • Exit nano (Ctrl+X, Y, Enter).
  • sudo udevadm control --reload (or reboot)
  • Install Python dependencies: python3 -m pip install -r ./requirements.txt
  • Run python3 vec-footpedal-hid-linux.py
  • Consider modifying the code to change the mappings.

Design Technique

  • Run sudo evtest with the device plugged in.
  • Select the footpedal with the list.
  • Press and release each button, and record the output, as follows.
Event: time 1695265224.178439, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1695265224.178439, type 1 (EV_KEY), code 256 (BTN_0), value 1
Event: time 1695265224.178439, -------------- SYN_REPORT ------------
Event: time 1695265224.466374, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001
Event: time 1695265224.466374, type 1 (EV_KEY), code 256 (BTN_0), value 0
Event: time 1695265224.466374, -------------- SYN_REPORT ------------
Event: time 1695265237.008789, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1695265237.008789, type 1 (EV_KEY), code 257 (BTN_1), value 1
Event: time 1695265237.008789, -------------- SYN_REPORT ------------
Event: time 1695265237.336736, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1695265237.336736, type 1 (EV_KEY), code 257 (BTN_1), value 0
Event: time 1695265237.336736, -------------- SYN_REPORT ------------
Event: time 1695265241.480220, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1695265241.480220, type 1 (EV_KEY), code 258 (BTN_2), value 1
Event: time 1695265241.480220, -------------- SYN_REPORT ------------
Event: time 1695265241.808159, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1695265241.808159, type 1 (EV_KEY), code 258 (BTN_2), value 0
Event: time 1695265241.808159, -------------- SYN_REPORT ------------
  • Read and understand the output.
  • The code is the 3 buttons.
  • 1 is a press, and 0 is a release.
  • Find a way to automatically figure out the correct device event path: /dev/input/event*
  • Write code using ChatGPT to read the inputs and call a function for the outputs.

Other Resources and Motivation

The following locations didn't really work, so I created this repo.

  • https://saulalbert.net/blog/transcription-with-a-foot-pedal-under-linux/
  • https://github.com/kostmo/footpedal
  • Formerly: https://code.google.com/archive/p/footpedal/issues/4#c5