4

I have a set of USB Pedals that I wish (need!) to configure with NixOS, because frankly my hands are killing me.

The pedals are identified in lsusb:

Bus 001 Device 006: ID 413d:2107

And evtest shows the following default key assignments:

sudo evtest /dev/input/event6
...
Input device ID: bus 0x3 vendor 0x413d product 0x2107 version 0x111
Input device name: "HID 413d:2107 Keyboard"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_Key)
    Event code 1 (KEY_ESC)
...
    Event code 240 (KEY_UNKNOWN)
  Event type 4 (EV_MSC)
    Event code 3 (MSC SCAN)
...
Event: time 1593452123.539558, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70004
Event: time 1593452123.539558, type 1 (EV_KEY), code 30 (KEY_A), value 1
Event: time 1593452123.539558, -------------- SYN_REPORT ------------
...

So following techtrickery.com and yulistic.gitlab.io, with the relevant NixOS Option, I have added lines to my extraHwdb rules:

services.udev.extraHwdb = ''
  evdev:input:b*v413Dp2107e*-*
    KEYBOARD_KEY_70004=f13
'';

I have tried some variations on the device line, notably keyboard:usb:v413Dp2107* and evdev:input:b*v413Dp2107e*.

Having added this to my configuration.nix, rebuilt (and switched!), and... nothing. The pedal continues to produce an 'a' key.

I am confident that the change is being picked up (if I deliberately remove a ';' in the file, it won't build). But testing with udevadm:

sudo udevadm info /dev/input/event6

P: /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:413D:2107.0004/input/input25/event6
N: input/event6
L: 0
S: input/by-path/pci-0000:00:14.0-usb-0:2:1.0-event-kbd
S: input/by-id/usb-413d_2107-event-kbd
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/0003:413D:2107.0004/input/input25/event6
E: DEVNAME=/dev/input/event6
E: MAJOR=13
E: MINOR=70
E: SUBSYSTEM=input
E: USEC_INITIALIZED=1296521621
E: PATH=/nix/store/k3hi6q6y10zrrgli0xa54zbvzs6pwdl1-udev-path/bin:/nix/store/k3hi6q6y10zrrgli0xa54zbvzs6pwdl1-udev-path/sbin
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1
E: ID_VENDOR=413d
E: ID_VENDOR_ENC=413d
E: ID_VENDOR_ID=413d
E: ID_MODEL=2107
E: ID_MODEL_ENC=2107
E: ID_MODEL_ID=2107
E: ID_REVISION=0000
E: ID_SERIAL=413d_2107
E: ID_TYPE=hid
E: ID_BUS=usb
E: ID_USB_INTERFACES=:030101:030102:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usbhid
E: ID_PATH=pci-0000:00:14.0-usb-0:2:1.0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_2_1_0
E: LIBINPUT_DEVICE_GROUP=3/413d/2107:usb-0000:00:14.0-2
E: DEVLINKS=/dev/input/by-path/pci-0000:00:14.0-usb-0:2:1.0-event-kbd /dev/input/by-id/usb-413d_2107-event-kbd
E: TAGS=:power-switch:

There is no evidence there of the configuration as requested. So presumably I'm doing something daft, but no matter how I stare, I cannot see it.

I'm a suspicious of the fact that the keyboard code (70004) is outside of the range reported by evtest in the header [0..240]; but I don't know if that is relevant.

Any pointers would be greatly appreciated.

1 Answer 1

3

You could try Footswitch, it supports your model and allows you to program the events.

Command line utlities for programming PCsensor and Scythe foot switches. There is support for both single pedal devices and three pedal devices.

footswitch [-123] [-r] [-s <string>] [-S <raw_string>] [-ak <key>] [-m <modifier>] [-b <button>] [-xyw <XYW>]
   -r          - read all pedals
   -1          - program the first pedal
   -2          - program the second pedal (default)
   -3          - program the third pedal
   -s string   - append the specified string
   -S rstring  - append the specified raw string (hex numbers delimited with spaces)
   -a key      - append the specified key
   -k key      - write the specified key
   -m modifier - ctrl|shift|alt|win
   -b button   - mouse_left|mouse_middle|mouse_right
   -x X        - move the mouse cursor horizontally by X pixels
   -y Y        - move the mouse cursor vertically by Y pixels
   -w W        - move the mouse wheel by W
1
  • Wow, thank you @eduardo (and, of course, Radoslav) - that is exactly what I needed. Jun 29, 2020 at 20:26

You must log in to answer this question.

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