2 .\" $FreeBSD: src/share/man/man4/joy.4,v 1.12.4.10 2002/07/22 14:21:51 ru Exp $
9 .Nd joystick device driver
11 To link into the kernel:
14 To load as a kernel loadable module:
19 The joystick device driver allows applications to read the status of
22 This device may be opened by only one process at a time.
24 The joystick status is read from a structure via a
27 The structure is defined in the header file as follows:
28 .Bd -literal -offset indent
30 int x; /* x position */
31 int y; /* y position */
32 int b1; /* button 1 status */
33 int b2; /* button 2 status */
37 Positions are typically in the range 0-2000.
38 .Ss One line perl example:
40 perl -e 'open(JOY,"/dev/joy0")||die;while(1)
41 {sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
46 calls are also available.
47 They take an argument of
49 .Bl -tag -width ".Dv JOY_SET_X_OFFSET"
50 .It Dv JOY_SETTIMEOUT Fa int *limit
51 Set the time limit (in microseconds) for reading the joystick
54 too small may prevent to get correct values for the positions (which
55 are then set to -2147483648), however this can be useful if one is
56 only interested by the buttons status.
57 .It Dv JOY_GETTIMEOUT Fa int *limit
58 Get the time limit (in microseconds) used for reading the joystick
60 .It Dv JOY_SET_X_OFFSET Fa int *offset
61 Set the value to be added to the X position when reading the joystick
63 .It Dv JOY_SET_Y_OFFSET Fa int *offset
64 Set the value to be added to the Y position when reading the joystick
66 .It Dv JOY_GET_X_OFFSET Fa int *offset
67 Get the value which is added to the X position when reading the joystick
69 .It Dv JOY_GET_Y_OFFSET Fa int *offset
70 Get the value which is added to the Y position when reading the joystick
73 .Sh TECHNICAL SPECIFICATIONS
74 The pinout of the DB-15 connector is as follows:
78 3 X1 (potentiometer #1)
81 6 Y1 (potentiometer #2)
86 11 X2 (potentiometer #3)
88 13 Y2 (potentiometer #4)
93 Pots are normally 0-150k variable resistors (0-100k sometimes), and
94 according to the IBM techref, the time is given by
95 Time = 24.2e-6s + 0.011e-6s * R/Ohms
97 .Bl -tag -width /dev/joy?
102 The joystick driver appeared in
105 .An Jean-Marc Zucconi Aq Mt jmz@cabri.obs-besancon.fr