项目作者: rgerganov

项目描述 :
Command-line utility for PCsensor foot switch
高级语言: C
项目地址: git://github.com/rgerganov/footswitch.git
创建时间: 2012-08-20T15:03:04Z
项目社区:https://github.com/rgerganov/footswitch

开源协议:MIT License

下载


Build Status

Footswitch

Command line utlities for programming PCsensor and Scythe foot switches.

The following list of devices are supported:

vendorId productId Program
0c45 7403 footswitch
0c45 7404 footswitch
413d 2107 footswitch
1a86 e026 footswitch
3553 b001 footswitch
0426 3011 scythe
055a 0998 scythe2

You can find the vendorId and productId of your device using the lsusb command on Linux.

The same kind of foot switches are used for building the popular VIM Clutch.

Building

Debian

On a debian machine, provided you have devscripts and equivs installed:

  1. mk-build-deps -i
  2. dpkg-buildpackage -us -uc -b

Or, you can build the package in a Docker container:

  1. docker build .

Archlinux

Footswitch is available in the AUR and can be installed using your favourite AUR helper, for example:

  • yay -S footswitch-git
  • paru -S footswitch-git

Other systems

The programs are using the hidapi library and should work on Linux and OSX. To build on Linux:

  1. sudo apt-get install libhidapi-dev
  2. git clone https://github.com/rgerganov/footswitch.git
  3. cd footswitch
  4. make
  5. sudo make install

The install target installs udev rules on Linux which allow running the programs without root.
You may need to use sudo otherwise.

To build on OSX:

  1. brew tap rgerganov/footswitch https://github.com/rgerganov/footswitch.git
  2. brew install --HEAD footswitch

Usage

  1. footswitch [-123] [-r] [-s <string>] [-S <raw_string>] [-ak <key>] [-m <modifier>] [-b <button>] [-xyw <XYW>]
  2. -r - read all pedals
  3. -1 - program the first pedal
  4. -2 - program the second pedal (default)
  5. -3 - program the third pedal
  6. -s string - append the specified string
  7. -S rstring - append the specified raw string (hex numbers delimited with spaces)
  8. -a key - append the specified key
  9. -k key - write the specified key
  10. -m modifier - ctrl|shift|alt|win
  11. -b button - mouse_left|mouse_middle|mouse_right
  12. -x X - move the mouse cursor horizontally by X pixels
  13. -y Y - move the mouse cursor vertically by Y pixels
  14. -w W - move the mouse wheel by W
  15. You cannot mix -sSa options with -kmbxyw options for one and the same pedal

_

  1. scythe [-123] [-r] [-a <key>] [-m <modifier>] [-b <button>]
  2. -r - read all pedals
  3. -1 - program the first pedal
  4. -2 - program the second pedal (default)
  5. -3 - program the third pedal
  6. -a key - append the specified key
  7. -m modifier - ctrl|shift|alt|win
  8. -b button - mouse_left|mouse_double|mouse_right
  9. You cannot mix -a and -m options with -b option for one and the same pedal

Examples for PCsensor

  1. footswitch -r
  2. read the persisted function in each pedal and print it on the console
  3. footswitch -k a
  4. program the second pedal to print the letter 'a' (also work for single pedal devices);
  5. as a general rule you don't need to specify -1, -2 or -3 if you have only one pedal
  6. footswitch -1 -k a -2 -k b -3 -k c
  7. program the first pedal to print 'a', second pedal to print 'b' and third pedal to print 'c'
  8. footswitch -1 -k esc -2 -k enter
  9. program the first pedal as Escape key and the second pedal as Enter key
  10. footswitch -1 -m ctrl -k a -3 -m alt -k f4
  11. program the first pedal as Ctrl+a and the third pedal as Alt+F4
  12. footswitch -1 -m ctrl -k a -3 -m shift -m alt -k s
  13. program the first pedal as Ctrl+a and the third pedal as Shift+Alt+s (Wikipedia "save")
  14. footswitch -m ctrl -b mouse_middle
  15. program the second pedal as Ctrl+<middle_mouse_click>
  16. footswitch -s 'hello world'
  17. program the second pedal to print 'hello world'
  18. footswitch -s 'hello' -s ' ' -s 'world'
  19. this will also program the second pedal to print 'hello world';
  20. you can specify multiple -s options and each option will append to the resulting string
  21. footswitch -a esc -a i
  22. program the second pedal to produce Escape and then the letter 'i'
  23. footswitch -s ls -a enter
  24. program the second pedal to print 'ls' and then hit Enter
  25. footswitch -S '29 C'
  26. program the second pedal with the specified 'raw' string (hex numbers delimited with spaces);
  27. you can find the hex code for each key at http://www.freebsddiary.org/APC/usb_hid_usages.php
  28. footswitch -1 -x 10 -2 -w 15 -3 -y -10
  29. program first pedal to move the mouse cursor 10 pixels left;
  30. second pedal to move mouse wheel 15 units up;
  31. third pedal to move the mouse cursor 10 pixels right

Examples for Scythe

  1. scythe -r
  2. read the persisted function in each pedal and print it on the console
  3. scythe -1 -a a -2 -a b -3 -a c
  4. program the first pedal to print 'a', second pedal to print 'b' and third pedal to print 'c'
  5. scythe -1 -m ctrl -a h -a o -2 -m alt -a f4 -3 -b mouse_double
  6. program the first pedal as Ctrl+h+o, the second pedal as Alt+F4 and the third pedal as double click

Hardware issues

Several people have reported misbehaviors with the PCsensor footswitch due to hardware issues.
If the pedal is continuously sending a keypress without being pressed, then most probably some of
the elements do not make good contact with the PCB. Follow the instructions contributed by @krasiyan
on how to verify and fix this.

Author

Radoslav Gerganov

Contributors