NAME
jslaunch - executes shell commands on joystick button presses
SYNOPSIS
jslaunch [-r buttons "command"] [-p time] [-w time] [-i buttons] [-l lockfile] [-d]
DESCRIPTION
jslaunch is a utility/daemon that will execute a shell command when a specified combination of joystick buttons is pressed. Up to 15 joystick button combinations are possible, provided you have 4 buttons.
One way to use it is as a backup way to shut down the computer if the terminal has been messed up, or shutting down the X server if it has crashed. It also makes the joystick buttons useful as a remote control device.
As the joystick interface doesn't supply interrupts, this program polls. The default polling interval is 500 milliseconds (half a second), but you can change this. The CPU impact of this polling action is minimal because the kernel joystick driver is not used (about 8 assembly instructions, every 500 milliseconds, will not produce more than 0.01 seconds of CPU time every 2 months, even with context switching, on a P100). The memory footprint of this program is also kept to the bare minimum (about 40 kB).
For an easy way of starting jslaunch as a daemon, look at jslaunchd(1) To test which joystick button has which number and supply the -r option with button specification, look at jslaunch_showbuttons(1)
jslaunch is setuid safe; special permissions are given up before the lock file is made and any shell command is executed. One reason you might not want to have jslaunch suid, is if you don't want other users to find out which joystick buttons you are pressing.
OPTIONS
- -r [1][2][3][4] command
-
Run command at button combination [1][2][3][4] The joystick button specification is a combination of digits without spaces in between, specifying the joystick buttons to be pressed; example: jslaunch -r 12 'ppp on' will run the command 'ppp on' when both buttons 1 and 2 are pressed. Note that it is advisory to have the command quoted.
- -p time
-
Set the polling time to time milliseconds (1/1000 of a second, aka. ms)
- -w time
-
Set the time between the detection of a joystick button press and the actual readout of which buttons are pressed to time milliseconds. This will allow the user some time to press all the required buttons simultaneously.
- -i [1][2][3][4]
-
Ignore input from the joystick buttons [1][2][3][4] Buttons are specified the same way as with -r.
- -d
-
Run as a daemon; this will also close stdin, stdout and stderr.
- -l lockfile
-
Create a file and lock it, so that if you try to run another jslaunch with the same -l lockfile option, it will refuse to start.
EXAMPLE
jslaunch -r 12 "/sbin/shutdown -r now" -r 34 "killall X" -p 250 -w 200 -d -l /var/lock/subsys/jslaunch.
Will reboot the system if both buttons 1 and 2 are pressed, and kill any X server if buttons 3 and 4 are pressed. The polling interval is 250 milliseconds, the wait time is 200 ms. It will start as a daemon, and will lock the file
SEE ALSO
VERSION
2.0, august 1998
BUGS
Please contact me if you find any
If jslaunch doesn't seem to react to button presses and you have the joystick interface on a Plug & Play card, you might have to enable it using isapnp. See the README file for more info.
AUTHOR
Sander Pronk <[email protected]>, with suggestions from Johan Walles.