Merge branch 'vendor/DHCPCD'
[dragonfly.git] / share / man / man4 / joy.4
1 .\"
2 .\" $FreeBSD: src/share/man/man4/joy.4,v 1.12.4.10 2002/07/22 14:21:51 ru Exp $
3 .\"
4 .Dd January 23, 1995
5 .Dt JOY 4
6 .Os
7 .Sh NAME
8 .Nm joy
9 .Nd joystick device driver
10 .Sh SYNOPSIS
11 To link into the kernel:
12 .Cd device joy
13 .Pp
14 To load as a kernel loadable module:
15 .Dl kldload joy
16 .Pp
17 .In sys/joystick.h
18 .Sh DESCRIPTION
19 The joystick device driver allows applications to read the status of
20 the PC joystick.
21 .Pp
22 This device may be opened by only one process at a time.
23 .Pp
24 The joystick status is read from a structure via a
25 .Fn read
26 call.
27 The structure is defined in the header file as follows:
28 .Bd -literal -offset indent
29         struct joystick {
30                 int x;         /* x position */
31                 int y;         /* y position */
32                 int b1;        /* button 1 status */
33                 int b2;        /* button 2 status */
34         };
35 .Ed
36 .Pp
37 Positions are typically in the range 0-2000.
38 .Ss One line perl example:
39 .Bd -literal -compact
40 perl -e 'open(JOY,"/dev/joy0")||die;while(1)
41 {sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
42 .Ed
43 .Ss ioctl calls
44 Several
45 .Fn ioctl
46 calls are also available.
47 They take an argument of
48 type int *
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
52 status.
53 Setting a value
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
59 status.
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
62 status.
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
65 status.
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
68 status.
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
71 status.
72 .El
73 .Sh TECHNICAL SPECIFICATIONS
74 The pinout of the DB-15 connector is as follows:
75 .Bd -literal
76   1  XY1 (+5v)
77   2  Switch 1
78   3  X1 (potentiometer #1)
79   4  Switch 1 (GND)
80   5  Switch 2 (GND)
81   6  Y1 (potentiometer #2)
82   7  Switch 2
83   8  N.C.
84   9  XY2 (+5v)
85  10  Switch 4
86  11  X2 (potentiometer #3)
87  12  Switch 3&4 (GND)
88  13  Y2 (potentiometer #4)
89  14  Switch 3
90  15  N.C.
91 .Ed
92 .Pp
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
96 .Sh FILES
97 .Bl -tag -width /dev/joy?
98 .It Pa /dev/joy?
99 joystick device files
100 .El
101 .Sh HISTORY
102 The joystick driver appeared in
103 .Fx 2.0.5 .
104 .Sh AUTHORS
105 .An Jean-Marc Zucconi Aq Mt jmz@cabri.obs-besancon.fr