rgerganov / footswitch Goto Github PK
View Code? Open in Web Editor NEWCommand-line utility for PCsensor and Scythe foot switches
License: MIT License
Command-line utility for PCsensor and Scythe foot switches
License: MIT License
I bought this as an Ikkegol triple foot switch control; footswitch.c already includes it, and in the event it works fine.
Isn't there any way to programmatically emulate releasing of pedal? I mean polling with some delay? thx
I believe I do have a compatible foot switch (though I bought it off of AliExpress):
$ lsusb -d 0c45:7403
Bus 002 Device 010: ID 0c45:7403 Microdia Foot Switch
However, when I try to use the utility I get the aforementioned message:
$ footswitch -r
cannot find footswitch with VID:PID=c45:7403 [init(), footswitch.c:96]
I am on Fedora Linux 23, fully updated current system. I do have the hidapi and hidapi-devel packages installed. I followed the installation procedure.
I even tried to modify the C code to investigate if it correctly understands it runs on Linux and not OSX (footswitch.c line 76) and it does. Now I'm out of ideas.
Any help or pointer would be greatly appreciated!
When I bypass the hub, I can read/write the configuration. But once I plug it in via a USB hub I get
error writing data (hid_error is not implemented yet) [usb_write(), footswitch.c:144]
Is a fix possible? I can provide any information that may be necessary.
Greetings. I love the software and actually bought a footswitch because I found this software. Thanks for writing it!
I'm having an issue where the foot press registers once, maybe, and then doesn't work again. I'm limited in my ability to troubleshoot and am wondering if anyone has any suggestions on figuring out why the footswitch doesn't work 100% of the time.
Hello @rgerganov.
You have a great app, unfortunately this app does not have a logo yet, may I donate a logo for your app?
I just got a new pedal from AliExpress and the VID:PID is 5131:2019 so it does not find it!
I have tried adding it to the list of VIDS in the source code but it still does not work so any suggestions?
When following the command line installation instructions for Linux, I get the following error when I get to the 'make' command:
cc footswitch.c common.c debug.c -o footswitch -Wall pkg-config hidapi-libusb --libs
footswitch.c:23:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
common.c:23:19: fatal error: ctype.h: No such file or directory
#include <ctype.h>
^
compilation terminated.
debug.c:22:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
make: *** [footswitch] Error 1
There seem to be missing files, how can I get them? Would really like to get this foot pedal working. Thanks!
Would this utility work for MacOS?
I'm attempting to set my foot pedal to a Gamepad Button for software that I am unable to change the key commands for. I have tried footswitch -S '30'
Which shows as 'X' key on (http://www.freebsddiary.org/APC/usb_hid_usages.php) but all I get is the ']' key. Am I missing something to set that command?
Trying to find a way to program right ctrl key only?
I've not found a way yet.
Thanks.
Hi there,
I think my version of OS X is preventing installation due to increased security. Here's the error I'm getting:
➜ Downloads git clone https://github.com/rgerganov/footswitch.git
Cloning into 'footswitch'...
remote: Counting objects: 78, done.
remote: Total 78 (delta 0), reused 0 (delta 0), pack-reused 78
Unpacking objects: 100% (78/78), done.
Checking connectivity... done.
➜ Downloads cd footswitch
➜ footswitch git:(master) make
cc footswitch.c common.c debug.c -o footswitch -Wall -DOSX -lhidapi
➜ footswitch git:(master) ✗ sudo make install
Password:
/usr/bin/install -c footswitch /usr/bin
install: /usr/bin/footswitch: Operation not permitted
make: *** [install] Error 71
Is it possible just to change the install location in the makefile? Or would I have to do something more extensive?
Thanks!
Hello! I have just bought new version of pedal from AliExpress and surprise: there are new VID:PID. Are there any chances to use your utility for that device?
I just installed the 0.8.0 release candidate of hidapi using brew. When I run make
in the footswitch folder I get the following error:
cc footswitch.c common.c debug.c -o footswitch -Wall -DOSX -lhidapi
footswitch.c:28:10: fatal error: 'hidapi/hidapi.h' file not found
#include <hidapi/hidapi.h>
^
1 error generated.
make: *** [footswitch] Error 1
I guess, somehow the hidapi install is not ok, but I don't have any idea what I could change..
Could you help me out?
Thanks in advance!
I recently grabbed a 6 button usb keyboard ( https://www.amazon.com.au/gp/product/B00X76DS80/ ) for some work and was delighted to see it's keycode in footswitch already. It defaults to outputting a b c d e f and works perfectly. I was hoping to reprogram using footswitch rather than booting to Windows and found the footswitch only supports 3 keys. Any chance of an update to support more keys?
sudo /usr/bin/footswitch -r
[switch 1]: a
[switch 2]: b
[switch 3]: c
$ lsusb -v -d 1a86:e026
Bus 001 Device 046: ID 1a86:e026 QinHeng Electronics
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x1a86 QinHeng Electronics
idProduct 0xe026
bcdDevice 0.00
iManufacturer 0
iProduct 0
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0042
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 212
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 10
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 41
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 10
```
Firs of all, footswitch is awesome.
But I'm trying to configure the pedal to write semicolons using footswitch -k ';'
or footswitch -k \;
or footswitch -S 0x33
, then output of footswitch -r
is fine, so everything seems well configured, but when I press the pedal it prints ñ
Hi,
First, thanks for the great software! It's much more convenient than running native utility in VM :)
My question is: is it possible to program a sequence of key combinations (e.g., ctrl+alt then win+d)? In other words, I'd like to issue several commands instead of pressing all keys at the same time.
Hi,
Using lsusb -d 0c45:7403 I get a response with a footswitch.
However, when I use footswitch -r it says cannot find footswitch..
With some looking around, I suspect the hid_open_path is going wrong..
What can I do to fix this?
Nice tool, thanks! I'm using it on Debian Wheezy, and I need root permissions to execute it:
sudo footswitch -r
It's not a bug, but I thought I'd mention it in case it helps any readers or you want to add it to your instructions.
I am trying to use the scythe footswitch without success.
When I execute scythe -r
I get that error getting feature report ((null)) [read_pedals(), scythe.c:136]
running as root but I restarted udev with:
udevadm control --reload-rules
/etc/init.d/udev restart
ALso I saw that on debian the hid
group for udev doesn't exist so I am using for tests plugdev that I used in the past with different udev rules for USB devices.
Many GNU/Linux distros require versions for packaging. Where do I find version information for footswitch OR shall I just timestamp it (ie: 2018.07.31.11.30)? Either way, please make it clear in the docs.
I was able to program my 3 pedal switch to generate the keys I'd like (thanks!), but after absentmindedly leaving my foot on the left pedal for around 7 seconds, the footswitch generated Windows-r followed by "http://software.pcsensor.com/pc_en.html", but it did not appear to generate an enter. I assume this is some sort of (undocumented?) functionality to help people get the windows program to program their footswitch, though the URL is currently a 404.
It isn't a big deal, but it would be nice to be able to disable the long-press feature, or even better to reprogram it for a different sequence. I don't have a windows VM to take a USB capture, but if there were unexplained URBs when you reversed the windows program, they might have been for this...
I have a PCSensor foot pedal. When plugged it windows 10 says it is a
Footswitch1-F1.8
I've tried the software under WSL but when I do
footswitch -r
I get
Cannot find footswitch with one of the supported VID:PID.
Check that the device is connected and that you have the correct permissions to access it. [init(), footswitch.c:109]
Is this a WSL problem or the footswitch model is not supported?
Thanks for this library!
Do I need to install anything extra for the code to work?
I ported the code to Windows, and although I don't get any error messages when sending commands to the pedal, whenever I press it, it just keeps sending the "b" keystroke.
I also noticed that -r
hangs forever unfortunately.
The PCsoftware download URLs is down, so I can't install their drivers.
Any tips?
sudo footswitch -1 -k ☺
Cannot encode key '☺'
And
sudo footswitch -1 -s '☺'
Cannot encode string: '☺'
There's no USB HID key for ☺.
Love this utility - it's so easy to use. Thanks for releasing it.
This is also an issue with other Unicode characters - for example: sudo footswitch -1 -s 'î'
Thank you very much for the software. It compiles cleanly on Ubuntu 12 64 bit. I'm considering purchasing two PCSensor single-foot switches. I have a question: is it possible with the "footswitch" utility, to map one foot switch to the "control" key? Only "control", not "control-someletter". So if I want to send "control-d" I would press the foot switch and hit "d" on the keyboard. By looking at your documentation and
http://www.freebsddiary.org/APC/usb_hid_usages.php
(" 0xE0 Keyboard LeftControl ")
I suspect that this command line might work:
footswitch -1 -S 'E0' ...?
Thank you again.
dokav@dokav-MacBook-Pro footswitch % make
make: pkg-config: Command not found
make: pkg-config: Command not found
cc -Wall -DOSX footswitch.c common.c debug.c -o footswitch
footswitch.c:28:10: fatal error: 'hidapi.h' file not found
#include <hidapi.h>
^~~~~~~~~~
1 error generated.
make: *** [footswitch] Error 1
Hi,
is it possible to send the right Control instead of the left control key.
Hi,
I successfully programmed my 3-pedal footpedal and it worked. However, I hadn't used it for about 3 months and decided to used it yesterday. When I try to use the middle peddle i.e. pedal 2, I am getting no response.
I checked the settings using footswitch -r, and it correctly says it is programmed for alt o. However when I press it nothing happen.
Not sure why??
Any ideas?
Kind regards,
Carol
Hi. Let me just start by saying you've written a great software here.
But I got an issue when setting two modifier keys (shift and control, in this case) on a triple pedal foot switch. When I step on one and then the other, the latter unsets the former modifier, so I can't use them both at the same time. So I can't ctrl+shift+ to control my terminal tabs and split windows. Other uses are also restricted (desktop goodies and games).
I noticed this same behavior with any two pedals on the switch, meaning the modifier is always forgotten when a second pedal is pressed, even when the second one is a simple letter and not a modifier.
On a different side, if I use one pedal from the triple switch plus any combination of other input methods (pedals, keyboard) then the combo is recognized correctly by the desktop.
Is this an intrinsic hardware limitation or something that could be improved on this software?
Hi,
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 012: ID 8087:0a2a Intel Corp.
Bus 001 Device 004: ID 064e:9700 Suyin Corp. Asus Integrated Webcam
Bus 001 Device 014: ID 0c45:7403 Microdia Foot Switch
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ footswitch -r
cannot find footswitch with VID:PID=c45:7403 [init(), footswitch.c:94]
Any idea?
Thanks!
I have a PCSensor 413D:2107 foot switch and the program is failing because dev == (nil) at footswitch.c 112. Can you suggest remedy?
Without ctrl:swapcaps, footswitch -m ctrl -k t
works as expected (Ctrl+T).
But with ctrl:swapcaps, it seems that it doesn't work as expected.(just T
is printed)
Even though with ctrl:swapcaps, there is a way to enable Ctrl+T.
It seems that combination with capslock and t is not allowed.
Do you know the way?
Ignore, failed to understand the basics of the -k option.
Thanks for the awesome program, helped a lot.
is it possible to run a shell script when button is pressed even the screen is locked?
now i achive this goal mapping a key shortcut but it does not run when screen is locked
Due to limitations with the libusb package on os x footswitch does not seem to work unfortunately. I begun to try to code around it but basically it requires not using the libusb libraries.
Specifically footswitch returns:
libusb: 0.025330 info [darwin_open] device open for access
libusb: 0.025748 error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access cannot claim interface, error: LIBUSB_ERROR_ACCESS [init(), footswitch.c:79]
When trying to run any command under footswitch. I have posted a how to for os x users over on the vim clutch page to get a foot pedal working under os x.
I'm not sure if it's a bug, undocumented behavior or something I've missed, but when using:
footswitch -3 -S '4E' -2 -S '51' -1 -S '52'
even if I keep pressing the pedal down, the cursor won't keep moving down/up. That is, it's as if the key was released / is no longer pressed.
However, if I program the pedal with:
footswitch -1 -k pagedown -2 -k down -3 -k up
maintaining the hold on the pedal keeps sending pagedown/down/up as expected.
Thanks
Hi,
Installed footswitch with 'sudo make install' for the device ID 0c45:7404 as of below.
But running footswitch requires superuser everytime. How to avoid 'sudo' for running footswitch every time?! Thanks.
Cheers,
/z
$ lsusb -d 0c45:7404
Bus 001 Device 003: ID 0c45:7404 Microdia$ make
cc footswitch.c common.c debug.c -o footswitch -Wall -I/usr/include/hidapi -lhidapi-libusb$ sudo make install
/usr/bin/install -c footswitch /usr/local/bin
/usr/bin/install -c -m 644 19-footswitch.rules /etc/udev/rules.d$ footswitch -r
Cannot find footswitch with VID:PID=c45:7403 or VID:PID=c45:7404 [init(), footswitch.c:101]$ sudo footswitch -r
[sudo] password for zenny:
[switch 1]: a
[switch 2]: b
[switch 3]: c
I'd like to configure a Scythe pedal.
I follow (successfully) the instructions to install your utility by github. And I get :
$ footswitch -r
cannot find footswitch with VID:PID=c45:7403 [init(), footswitch.c:85]
It's not surprising, because :
$ lsusb
Bus 004 Device 004: ID 0426:3011 Integrated Device Technology, Inc.
So, is it really impossible ? Or is there a trick I can test ?
the title says it all. A note on README should be enough, although some warnings when init_pid
( actually hid_open
) fails would be most welcome
scythe -r
getting the error:
error getting feature report ((null)) [read_pedals(), scythe.c:136]
MacOs 10.14.6
hidapi 0.9.0
lsusb device info:
Bus 020 Device 001: ID 0426:3011 Integrated Device Technology Composite Device
Any ideas what might be causing it?
Thanks for the sw. I ordered a couple of single pedal switch from eBay, and when the first one arrived, I was able to configure it with footswitch without any problems.
Some time later I got the other one. Testing it, I found out that it did not work with footswitch sw. I noticed that this other switch is recognized as
ID 1130:660c Tenx Technology, Inc. Foot Pedal/Thermometer,
i.e with a different usb id.
I put it apart and noticed that the pcb board had a mark on it:
FS4 V5
PCsensor.com
090728-091118
that made me think that the device is similar as the other one.
I'm no programmer and have no knowledge of usb, but I came to the idea, that changing the usb id in the software might help. Am I totally lost?
I am having a Footswitch with the id 138a:0090
.
Following the usb interface:
Bus 001 Device 007: ID 138a:0090 Validity Sensors, Inc.
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 16
bDeviceProtocol 255
bMaxPacketSize0 8
idVendor 0x138a Validity Sensors, Inc.
idProduct 0x0090
bcdDevice 1.64
iManufacturer 0
iProduct 0
iSerial 1
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 53
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 5
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 4
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval
Is this familiar to the interface of other devices?
I want to get a foot switch but I want that are configurable by a script.
As example when I press a switch I want to execute a bash script that can check what window has the focus and do specific things.
In that way I can use also for other application then only VIM.
I am having the problem that i can't write while pressing the footpedal which is kinda annoying while transcribing.
Thank you very much for this. This is only reason i had a version of windows running!!!
Is it possible to program the Scythe's PCsensor footswitch to send different mouse buttons than the already supported left and right mouse button?
My mouse for example has a Left, Right, Middle, 4th and 5th mouse button and I would like to program the footswitch to send the code for a 6th mouse button so I can bind it to a completely different function.
Unfortunately the functionality at least is not in this programming software yet and I was wondering if it is even supported by the hardware and the communication protocol. Sadly I have no expertise regarding the hardware or the communication protocol.
Is it possible to reset the foot switch to the behaviour it had before a command was used?
Background: Before I used footswitch, the foot switch caused a keystroke that lasted as long as the switch was pressed. After using footswitch, the switch apparently only sends a short keystroke.
I can switch back to the defaut b key with footswitch -s b
, but it has not the original behaviour.
Hi,
I have just received my pair of pedals for build a vim-clutch (hacking one pedal into another for include the release event), the idea is to configure the press with the "i" key and the release with "esc" in order to work much better on the vim editor
Unfortunately seems like I'm totally unable to configure it, seems like the pedal uses same identifiers but in fact I can configure them independently, but unable to do it correctly, for example if I configure the pedal 2 the first deconfigures, also seems like that the ESC key is interpreted as "º"
I think that I should make a video of how it is acting, or how i can give you more details ?
Thanks
Thanatermesis
I am currently trying to get my PCSensor foot switch to work using multiple modifier keys at once with my German keyboard layout on Ubuntu 18.04.
Basically I need Alt Ctrl + 7 which inserts {
using the regular keyboard. Trying to use either
./footswitch -S 'e9 e3' -s 7
(leading to <XF86Eject><Super_L>7
with -r
) or./footswitch -m alt -m ctrl -k 7
(leading to ctrl+alt+7
)does not seem to work. (These codes are from xmodmap -pk
and xev -event keyboard
. There are other problems using the ones from the linked USB HID usage table.) In the first case, it will just print 7
and the second case does not seem to produce any output at all.
Trying to use ß
as a key (to get a backslash) does not work as well as this character cannot be encoded: Cannot encode key 'ß'
.
Is there anything I can do about this?
(By the way: Using the "official" software on Windows the ssharp
character does not work, too, as the software inserts ]
instead. Configuring the foot switch on Windows and using the configured keys on Ubuntu does not work as well as the wrong output gets produced.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.