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