ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/share/man/man4/joy.4
Revision: 11739
Committed: Mon Jul 9 23:29:18 2018 UTC (5 years, 9 months ago) by laffer1
File size: 3114 byte(s)
Log Message:
update man pages

File Contents

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

Properties

Name Value
svn:keywords MidnightBSD=%H