File: README

package info (click to toggle)
jslaunch 2.0-9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 156 kB
  • ctags: 132
  • sloc: ansic: 838; sh: 169; makefile: 110
file content (189 lines) | stat: -rw-r--r-- 6,946 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
                           jslaunch 2.0

Sander Pronk


WWW: http://gene.wins.uva.nl/~spronk/jslaunch
for download URL see webpage.

Description:
============
jslaunch is a very small daemon/program that will start a specified
shell command when a combination of joystick buttons is pressed. 
One of its uses is as a backup way to make a clean shutdown 
if your console has been messed up by X11 or SVGAlib and you 
don't have a terminal sitting on your desk to log in and 
shut down from, but you can use it for example as a remote 
control to do just about anything (including starting a measurement
on an experimental setup connected to your computer).

You will not need any joystick drivers as this program will
bypass the joystick drivers and read the ports directly.

It can execute any number of specified commands on any number of 
button combinations. (In fact the maximum number is 15, because
there are only 4 joystick button inputs).

This program is similar to 'jsr_daemon' by Scott Heavner but
it's smaller and simpler. jslaunch uses low level I/O port access, 
thereby using less memory. It's possible, but not recommended
to use the kernel joystick drivers together with this program.
(They do work together perfectly, but you don't want your computer 
shutting down while you're playing a game because you pressed 
the wrong button). 

jslaunch works by polling the joystick port (every 1/2 second by 
default) and if a button combination is pressed it will execute the 
corresponding command through the system(3) library function. 
To execute the command again, the previous command should have
exited and you will have to release the buttons.

The whole polling section takes about 8 assembly instructions, 
so if this is executed once a second, you'll never notice it in
the system load (On a P100 it should have a cumulative CPU usage
time of about 1 second per year). 
The memory consumption of this daemon is about as small as can be 
(as far as I know): about 40 k of unshared memory. It's smaller
than the update daemon (the smallest process) on my system.

The program needs root permissions to get I/O port acces rights, but
is setuid safe, as it gives up root permissions before making
any lock file or executing any shell command, so this program
is installed suid root by default. But, if you don't like the idea 
of other users on your system being able to see which joystick buttons
are pressed, you can always disable this. The same goes for the RPM, 
which installs jslaunch and jslaunch_showbuttons setuid root by default.

It's best NOT to use tools like sudo with jslaunch, because
then the giving up of root permissions may not give the desired
results and users may be able to execute arbitrary commands as root.

There is a test program 'jslaunch_showbuttons' which will display the buttons 
pressed so they can be used as argument to the -r option. 
In addition, there is a wrapper, jslaunchd, which will read parameters 
from an input file (/etc/jslaunchd.conf) and run jslaunch accordingly. 
jslaunchd is also capable of stopping/restarting jslaunch.

Do not forget to enable your game card port if you have it sitting
on a Plug&Play card, like the soundblaster 16 PnP. Use isapnp to do that. 
The I/O base for the joystick port is 0x201, so a statement like:

(CONFIGURE CTL0028/269665362 (LD 3
#     Compatible device id PNPb02f
#     ANSI string -->Game<--
#     Logical device decodes 16 bit IO address lines
#         Minimum IO base address 0x0200
#         Maximum IO base address 0x0200
#         IO base alignment 1 bytes
#         Number of IO addresses required: 8
(IO 0 (BASE 0x0201))
(ACT Y)
))

in your /etc/isapnp.conf file will do.

Requirements:
=============

- An intel or alpha (compiles, untested) box running Linux
- Joystick (at least the buttons should function)

Usage:
======
From the man page:

SYNOPSIS
       jslaunch [-r buttons "command"] [-p time]  [-w  time]  [-i
       buttons] [-l lockfile] [-d]

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 joy-
            stick buttons to be pressed; example: jslaunch -r  12
            'ppp on' will run the command 'ppp on' when both but-
            tons 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)

       -w time
            Set the time between the detection of a joystick but-
            ton 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


INSTALLING & Running at boot time
=================================

If you have a sys V init system (i.e. one which uses init.d and
rc[0-6].d directories, like Red Hat and Debian), you can use
the jslaunch-install script, which will make the executable and
set the correct scripts in the init.d and rc*.d dirs. 
To make the executable manually type:

make clean

make


make suid-install

or

make install
if you don't want jslaunch & jslaunch_showbuttons to be 
suid root. This is perfectly safe, but will enable users on
your system to track which joystick buttons are pressed.

Included is a script: "jslaunch-install" which you can run to
put everything in place. This will only work if you have a
sys V type init system (Red Hat, Debian, ...). If you have a 
different boot system (like Slackware) then you'll have to run 
the script "jslaunch-install-nosysv"


Copyright
=========
jslaunch is copyrighted by Sander Pronk (1998) and is
licensed through the GNU General Public License. Read the
COPYING file for the complete license.
 

Have fun,

Sander
<pronk@amolf.nl>

P.S. If you have any problems compiling/running jslaunch, 
please contact me.

P.P.S. if you find any bugs or ways to decrease memory consumption,
please let me know!