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