9 .Nd joystick device driver
11 To link into the kernel:
14 To load as a kernel loadable module:
18 .Pa /boot/device.hints :
19 .Cd hint.joy.0.at="isa"
20 .Cd hint.joy.0.port="0x201"
21 .Cd hint.joy.1.at="isa"
22 .Cd hint.joy.1.port="0x201"
26 The joystick device driver allows applications to read the status of
29 This device may be opened by only one process at a time.
31 The joystick status is read from a structure via a read()
33 The structure is defined in the header file as follows:
35 .Bd -literal -offset indent
37 int x; /* x position */
38 int y; /* y position */
39 int b1; /* button 1 status */
40 int b2; /* button 2 status */
44 Positions are typically in the range 0-2000.
45 .Ss One line perl example:
47 perl -e 'open(JOY,"/dev/joy0")||die;while(1)
48 {sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
51 Several ioctl() calls are also available.
52 They take an argument of
54 .Bl -tag -width JOY_SET_X_OFFSET
55 .It Dv JOY_SETTIMEOUT Fa int *limit
56 Set the time limit (in microseconds) for reading the joystick
59 too small may prevent to get correct values for the positions (which
60 are then set to -2147483648), however this can be useful if one is
61 only interested by the buttons status.
62 .It Dv JOY_GETTIMEOUT Fa int *limit
63 Get the time limit (in microseconds) used for reading the joystick
65 .It Dv JOY_SET_X_OFFSET Fa int *offset
66 Set the value to be added to the X position when reading the joystick
68 .It Dv JOY_SET_Y_OFFSET Fa int *offset
69 Set the value to be added to the Y position when reading the joystick
71 .It Dv JOY_GET_X_OFFSET Fa int *offset
72 Get the value which is added to the X position when reading the joystick
74 .It Dv JOY_GET_Y_OFFSET Fa int *offset
75 Get the value which is added to the Y position when reading the joystick
78 .Sh TECHNICAL SPECIFICATIONS
79 The pinout of the DB-15 connector is as follow:
83 3 X1 (potentiometer #1)
86 6 Y1 (potentiometer #2)
91 11 X2 (potentiometer #3)
93 13 Y2 (potentiometer #4)
98 Pots are normally 0-150k variable resistors (0-100k sometimes), and
99 according to the IBM technical reference, the time is given by
100 Time = 24.2e-6s + 0.011e-6s * R/Ohms
102 .Bl -tag -width /dev/joy?
104 joystick device files
107 The joystick driver appeared in
110 .An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr