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