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