USB Footswitch Programmer Code
Linux software to program a usb footswitch
Brought to you by:
j-e-f-f-g
File | Date | Author | Commit |
---|---|---|---|
doc | 2024-10-29 |
![]() |
[79ec10] first version |
src | 2024-10-29 |
![]() |
[79ec10] first version |
install_usbpedal.sh | 2024-10-29 |
![]() |
[79ec10] first version |
readme.htm | 2024-10-29 |
![]() |
[79ec10] first version |
<html><head><title>Usb Footswitch Programmer</title></head><body bgcolor=white text=black link=blue vlink=purple alink=purple> Numerous companies make footswitches that can be attached to a usb port on your computer. The footswitch can then be programmed to simulate a mouse button press. Alternately the footswitch can be programmed to simulate a series of key presses on your computer keyboard. Here's an example of such a footswitch: <p><img src="doc/pedal.webp"> <p>You have ability to choose which mouse button, or series of keys, are to be simulated. This is done by running a software program (included with the footswitch) which presents a graphical window to let you enter your desired settings. Typically, the included software program is written to run only under the Windows operating system. So, if you run Linux, you still need to be able to boot up Windows in order to program your footswitch with the included software. <p>The <b>Usb Footswitch Programmer</b> is a Linux program that you can instead use to program your footswitch on Linux. You do not need Windows in order to do so. <p>This program presents a graphical window to set the keyboard or mouse command generated by the programmable USB foot switch/pedal. It supports 1 to 3 pedal units made by PCsensor, Scythe, Stritch, PcSensor, Delcom, and other models using the same USB chips. <p><hr size=5 noshade><h2><p align=center><font color=red>Compile (create) the program</font></p></h2> <p>Before you run the program, you must first create the program from the source code. <ol><li>Download <b>usbpedal.tar.7z</b> and unzip (extract) it to your Home folder. You should see a folder named <font color=green>usbpedal</font>. Open this folder, and you should see another folder named <font color=green>src</font> and a file named <font color=green>install_usbpedal.sh</font>. </li> <p><li>Open a terminal window in this usbpedal folder. (ie, Open a terminal window and change the directory to </b>~/usbpedal</b>). </li> <p><li>Type the following line in the terminal window, then press Enter: <pre>chmod 755 ./install_usbpedal.sh </pre> <p><li>Finally, type the following line in the terminal window, then press Enter: <pre>sudo ./install_usbpedal.sh </pre> <font color=brown>Note:</font> If your distro doesn't have sudo setup for you, then open a root terminal instead to run the above command (without the word "sudo"). </li> </ol> <p>This runs a utility (in the terminal window) that attempts to compile and install the software. Answer the displayed questions. <p>If your distro uses the apt, pacman, or dnf package manager, then the installer will try to download/install all needed dependencies. If not, you will need to manually install the packages that the installer reports. <p><hr size=5 noshade><h2><p align=center><font color=red>Run the program</font></p></h2> <p>Attach your footswitch to the computer before running the program. <p>If the installation succeeded, you will find a "USB Footswitch Programmer" command in your desktop menu. This will start the program, prompting you to enter your password. In order to directly program the footswitch, special access is required (which can be gained only via your password). <p>After typing your password, and pressing Enter, a window will appear listing all the supported USB footswitches currently attached to your computer. Click on a name to choose that pedal for programming. <p>If there is no "USB Footswitch Programmer" command in your desktop menu, then you have 2 options: <ol><li>Whenever you need to use the program, open a terminal window, type the following line, and press Enter: <pre>sudo usbpedal </pre> </li> <li>Manually install either the pkexec, gksudo, or lxqt-sudo package. Then run "install_usbpedal.sh" again. </li> </ol> <p><hr size=5 noshade><h2><p align=center><font color=red>A pedal's settings</font></p></h2> <p>The window will display the current settings for the pedal. If the pedal is set to imitate a mouse button, it will look similiar to this: <p><img src="doc/win1.gif"> <p>The <font color=green>Function As</font> setting indicates that the pedal is set to imitate a mouse button. The 3 buttons below, labeled "Left,", "Right", and "Middle", indicate which mouse button will be imitated when the footswitch is activated. Here, the choice of "Left" is selected. If you select "Right" or "Middle", then the footswitch will be immediately reprogrammed to that choice. <p>Some footswitch models don't support a middle button. In that case, no middle choice is shown. Other footswitch models can imitate a double-click (of the left mouse button). In that case, a double-click choice is shown. <p>If the pedal is instead set to imitate a computer keyboard, the window will look like this: <p><img src="doc/win2.gif"> <p>Now Function As indicates that the pedal is set to imitate the computer keyboard. <p>In the box beside the <font color=green>Set Keys</font> button you see the combination of keys that the pedal imitates. In the illustration below, that's: <pre>L-Ctrl A </pre> <p>This indicates the <b>Left control</b> and <b>A</b> keys. In other words, when you activate the pedal, it imitates you pressing your computer's left control and A keys simultaneously. If you want to change this, then click the <font color=green>Set Keys</font> button. The window will prompt you to press your desired keys combination. Let's assume you wish to imitate pressing the <b>Left Ctrl</b>, <b>Right shift</b>, and <b>L</b> keys simultaneously. <p>First, press and hold down the Ctrl key on the left. While you continue holding this key down, you should see "L-Ctrl" displayed in red. While still holding down this key, also press and hold down the shift key on the right. While you continue holding both keys down, you should see the words "L-Ctrl" and "R-Shift" displayed. Continue holding these 2 keys while you also press and hold the "L" key. You should see "L-Alt R-Shift L" displayed. Now release all 3 keys simultaneously, and you should see the words change to the color black. This indicates that you've now programmed this new key combination for the pedal. You can click the Ok button to return to the pedal's settings. <p>Now, when you activate the pedal, it will imitate pressing those 3 keys. If you continue holding down the pedal, it will eventually start repeating these 3 keys, until you finally release the pedal. If you don't want the keys continuously repeated while you hold the pedal, then click on the box labeled <font color=green>Key repeat</font> to remove the X. Some footswitch models do not give you the option of disabling repeat. In that case, the repeat option is not shown. <p><hr size=5 noshade><h2><p align=center><font color=red>Multiple pedals</font></p></h2> <p>Most footswitches have only one pedal. But some models have 2 or 3 pedals. For such a model, the settings for each pedal are shown separately, and a menu bar appears at the top of the window to choose which pedal's settings to display. For example, here we have a model that contains 2 pedals. The menu bar has two pedals to choose. <p><img src="doc/win3.gif"> <p>"Pedal 2" is shown in red, which means that the settings shown are for the second pedal. If you click on the words <font color=green>Pedal 1</font>, then it will turn red, and the window will switch to showing pedal 1's settings. <p><hr size=5 noshade><h2><p align=center><font color=red>Test pedals</font></p></h2> <p>After programming all pedals as desired, you can then test the operation. Click the <font color=green>Test</font> button. The window will now display a box for each pedal. For example, for our model with 2 pedals, there will be two boxes as so: <p><img src="doc/win4.gif"> <p>When you activate a pedal, its repective box onscreen should light up. <p>When finished programming the footswitch, you can then simply close the window to end the program. Or, if you have another footswitch to program, you can click on the <font color=green>Find</font> button to pick out this footswitch from the list of connected devices. </body></html>