Wiki
Clone wikiusb_footswitch_driver / Home
A linux driver for the Scythe usb footswitch II
This is my driver to manage the Scythe usb footswitch II.
Motivations
I use a modal editor for programming, I keep switching modes all the time. One day I just found convenient to use my feet to switch between modes while programming. I bought a Scythe usb footswitch II to use under GNU/Linux. As expected it came with a Windows driver only. When plugin it on a PC running a Linux kernel, pressing the pedals only sends numbers.
In a first time I've been using an evdev driver patch and an Xorg configuration explained by this tutorial
It worked fine, but it was really annoying to set up, and I didn't like the idea of patching the evdev driver. So I decided to make my own driver to manage the device.
Compilation
Pre-requisite
Be sure to have your running kernel sources installed. See customization before compiling.
Build
Just run make.
Install
You have to load the driver, just run the load_driver.sh script as root. Then plug your device. By default the device is binded to the usbhid driver. The script will do what's necessary for it to be binded to the driver when you plug it.
Customization
You'll have to customize the driver for your device. Configuration information are in the footswitch_config.h file.
Device identifiers
Check that the device ids are matching your devices one.
To do so just plug your device run:
lsusb
Bus 00x Device 00x: ID 0426:3011 Integrated Device Technology, Inc.
#!c #define VENDOR_ID 0x0426 // Change it depending on your device #define PRODUCT_ID 0x3011
Pedals actions
So far there are no way to configure the driver with a userland file, values are written in the code. To change the values, just search for the following code
#!c #define FS_PEDALS 3 /*! * structure holding keycodes for the footswtich driver * replace keycode with the proper values * Those values are listed in linux/include/linux/input.h or * linux/include/uapi/linux/input.h for latest kernels */ static const unsigned char usb_fs_keycode[FS_PEDALS] = { 63, 65, 64 };
The list of values are listed in the file indicated in the comments. Here is a set of useful values taken from this file. Of course you can use other values as long as it is a valid keycode for your running kernel.
#!c #define KEY_ESC 1 #define KEY_1 2 #define KEY_2 3 #define KEY_3 4 #define KEY_4 5 #define KEY_5 6 #define KEY_6 7 #define KEY_7 8 #define KEY_8 9 #define KEY_9 10 #define KEY_0 11 #define KEY_MINUS 12 #define KEY_EQUAL 13 #define KEY_BACKSPACE 14 #define KEY_TAB 15 #define KEY_Q 16 #define KEY_W 17 #define KEY_E 18 #define KEY_R 19 #define KEY_T 20 #define KEY_Y 21 #define KEY_U 22 #define KEY_I 23 #define KEY_O 24 #define KEY_P 25 #define KEY_LEFTBRACE 26 #define KEY_RIGHTBRACE 27 #define KEY_ENTER 28 #define KEY_LEFTCTRL 29 #define KEY_A 30 #define KEY_S 31 #define KEY_D 32 #define KEY_F 33 #define KEY_G 34 #define KEY_H 35 #define KEY_J 36 #define KEY_K 37 #define KEY_L 38 #define KEY_SEMICOLON 39 #define KEY_APOSTROPHE 40 #define KEY_GRAVE 41 #define KEY_LEFTSHIFT 42 #define KEY_BACKSLASH 43 #define KEY_Z 44 #define KEY_X 45 #define KEY_C 46 #define KEY_V 47 #define KEY_B 48 #define KEY_N 49 #define KEY_M 50 #define KEY_COMMA 51 #define KEY_DOT 52 #define KEY_SLASH 53 #define KEY_RIGHTSHIFT 54 #define KEY_KPASTERISK 55 #define KEY_LEFTALT 56 #define KEY_SPACE 57 #define KEY_CAPSLOCK 58 #define KEY_F1 59 #define KEY_F2 60 #define KEY_F3 61 #define KEY_F4 62 #define KEY_F5 63 #define KEY_F6 64 #define KEY_F7 65 #define KEY_F8 66 #define KEY_F9 67 #define KEY_F10 68
Status
So far the driver has been working with linux kernels 3.9.x and 3.10.x It has only been tested with a 3 pedals footswitch, so if you're experiencing problems with an other model, please raise an issue.
Other information:
See the device
Special thanks
A huge thank to Dorian Zaccaria who helped me a lot in the documentation process to make this driver.
Updated