]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/joy.4
This commit was generated by cvs2svn to compensate for changes in r163820,
[FreeBSD/FreeBSD.git] / share / man / man4 / joy.4
1 .\"
2 .\" $FreeBSD$
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
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"
23 .Pp
24 .In sys/joystick.h
25 .Sh DESCRIPTION
26 The joystick device driver allows applications to read the status of
27 the PC joystick.
28 .Pp
29 This device may be opened by only one process at a time.
30 .Pp
31 The joystick status is read from a structure via a read()
32 call.
33 The structure is defined in the header file as follows:
34 .Pp
35 .Bd -literal -offset indent
36         struct joystick {
37                 int x;         /* x position */
38                 int y;         /* y position */
39                 int b1;        /* button 1 status */
40                 int b2;        /* button 2 status */
41         };
42 .Ed
43 .Pp
44 Positions are typically in the range 0-2000.
45 .Ss One line perl example:
46 .Bd -literal -compact
47 perl -e 'open(JOY,"/dev/joy0")||die;while(1)
48 {sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
49 .Ed
50 .Ss ioctl calls
51 Several ioctl() calls are also available.
52 They take an argument of
53 type int *
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
57 status.
58 Setting a value
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
64 status.
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
67 status.
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
70 status.
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
73 status.
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
76 status.
77 .El
78 .Sh TECHNICAL SPECIFICATIONS
79 The pinout of the DB-15 connector is as follow:
80 .Bd -literal
81   1  XY1 (+5v)
82   2  Switch 1
83   3  X1 (potentiometer #1)
84   4  Switch 1 (GND)
85   5  Switch 2 (GND)
86   6  Y1 (potentiometer #2)
87   7  Switch 2
88   8  N.C.
89   9  XY2 (+5v)
90  10  Switch 4
91  11  X2 (potentiometer #3)
92  12  Switch 3&4 (GND)
93  13  Y2 (potentiometer #4)
94  14  Switch 3
95  15  N.C.
96 .Ed
97 .Pp
98 Pots are normally 0-150k variable resistors (0-100k sometimes), and
99 according to the IBM techref, the time is given by
100 Time = 24.2e-6s + 0.011e-6s * R/Ohms
101 .Sh FILES
102 .Bl -tag -width /dev/joy?
103 .It Pa /dev/joy?
104 joystick device files
105 .El
106 .Sh HISTORY
107 The joystick driver appeared in
108 .Fx 2.0.5 .
109 .Sh AUTHORS
110 .An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr