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