Sweep over our manual pages and remove .Pp before a .Bd or .Bl without
[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 .\" $DragonFly: src/share/man/man4/joy.4,v 1.6 2008/05/02 02:05:05 swildner Exp $
4 .\"
5 .Dd January 23, 1995
6 .Dt JOY 4
7 .Os
8 .Sh NAME
9 .Nm joy
10 .Nd joystick device driver
11 .Sh SYNOPSIS
12 To link into the kernel:
13 .Cd device joy
14 .Pp
15 To load as a kernel loadable module:
16 .Dl kldload joy
17 .Pp
18 .In sys/joystick.h
19 .Sh DESCRIPTION
20 The joystick device driver allows applications to read the status of
21 the PC joystick.
22 .Pp
23 This device may be opened by only one process at a time.
24 .Pp
25 The joystick status is read from a structure via a 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 ioctl() calls are also available.
45 They take an argument of
46 type int *
47 .Bl -tag -width ".Dv JOY_SET_X_OFFSET"
48 .It Dv JOY_SETTIMEOUT Fa int *limit
49 Set the time limit (in microseconds) for reading the joystick
50 status.
51 Setting a value
52 too small may prevent to get correct values for the positions (which
53 are then set to -2147483648), however this can be useful if one is
54 only interested by the buttons status.
55 .It Dv JOY_GETTIMEOUT Fa int *limit
56 Get the time limit (in microseconds) used for reading the joystick
57 status.
58 .It Dv JOY_SET_X_OFFSET Fa int *offset
59 Set the value to be added to the X position  when reading the joystick
60 status.
61 .It Dv JOY_SET_Y_OFFSET Fa int *offset
62 Set the value to be added to the Y position  when reading the joystick
63 status.
64 .It Dv JOY_GET_X_OFFSET Fa int *offset
65 Get the value which is added to the X position  when reading the joystick
66 status.
67 .It Dv JOY_GET_Y_OFFSET Fa int *offset
68 Get the value which is added to the Y position  when reading the joystick
69 status.
70 .El
71 .Sh TECHNICAL SPECIFICATIONS
72 The pinout of the DB-15 connector is as follows:
73 .Bd -literal
74   1  XY1 (+5v)
75   2  Switch 1
76   3  X1 (potentiometer #1)
77   4  Switch 1 (GND)
78   5  Switch 2 (GND)
79   6  Y1 (potentiometer #2)
80   7  Switch 2
81   8  N.C.
82   9  XY2 (+5v)
83  10  Switch 4
84  11  X2 (potentiometer #3)
85  12  Switch 3&4 (GND)
86  13  Y2 (potentiometer #4)
87  14  Switch 3
88  15  N.C.
89 .Ed
90 .Pp
91 Pots are normally 0-150k variable resistors (0-100k sometimes), and
92 according to the IBM techref, the time is given by
93 Time = 24.2e-6s + 0.011e-6s * R/Ohms
94 .Sh FILES
95 .Bl -tag -width /dev/joy?
96 .It Pa /dev/joy?
97 joystick device files
98 .El
99 .Sh HISTORY
100 The joystick driver appeared in
101 .Fx 2.0.5 .
102 .Sh AUTHORS
103 .An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr