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