9 .Nd joystick device driver
11 To compile this driver into the kernel,
12 place the following lines in your
13 kernel configuration file:
14 .Bd -ragged -offset indent
18 Alternatively, to load the driver as a
19 module at boot time, place the following line in
21 .Bd -literal -offset indent
26 .Pa /boot/device.hints :
27 .Cd hint.joy.0.at="isa"
28 .Cd hint.joy.0.port="0x201"
32 The joystick device driver allows applications to read the status of
35 This device may be opened by only one process at a time.
37 The joystick status is read from a structure via a read()
39 The structure is defined in the header file as follows:
41 .Bd -literal -offset indent
43 int x; /* x position */
44 int y; /* y position */
45 int b1; /* button 1 status */
46 int b2; /* button 2 status */
50 Positions are typically in the range 0-2000.
51 .Ss One line perl example:
53 perl -e 'open(JOY,"/dev/joy0")||die;while(1)
54 {sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
57 Several ioctl() calls are also available.
58 They take an argument of
60 .Bl -tag -width JOY_SET_X_OFFSET
61 .It Dv JOY_SETTIMEOUT Fa int *limit
62 Set the time limit (in microseconds) for reading the joystick
65 too small may prevent to get correct values for the positions (which
66 are then set to -2147483648), however this can be useful if one is
67 only interested by the buttons status.
68 .It Dv JOY_GETTIMEOUT Fa int *limit
69 Get the time limit (in microseconds) used for reading the joystick
71 .It Dv JOY_SET_X_OFFSET Fa int *offset
72 Set the value to be added to the X position when reading the joystick
74 .It Dv JOY_SET_Y_OFFSET Fa int *offset
75 Set the value to be added to the Y position when reading the joystick
77 .It Dv JOY_GET_X_OFFSET Fa int *offset
78 Get the value which is added to the X position when reading the joystick
80 .It Dv JOY_GET_Y_OFFSET Fa int *offset
81 Get the value which is added to the Y position when reading the joystick
84 .Sh TECHNICAL SPECIFICATIONS
85 The pinout of the DB-15 connector is as follow:
89 3 X1 (potentiometer #1)
92 6 Y1 (potentiometer #2)
97 11 X2 (potentiometer #3)
99 13 Y2 (potentiometer #4)
104 Pots are normally 0-150k variable resistors (0-100k sometimes), and
105 according to the IBM techref, the time is given by
106 Time = 24.2e-6s + 0.011e-6s * R/Ohms
108 .Bl -tag -width /dev/joy?
110 joystick device files
118 .An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr