1997-03-07 02:50:01 +00:00
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-03-07 02:50:01 +00:00
|
|
|
.\"
|
1995-01-25 21:41:09 +00:00
|
|
|
.Dd January 23, 1995
|
2001-02-20 11:07:27 +00:00
|
|
|
.Dt JOY 4
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1995-01-25 21:41:09 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm joy
|
|
|
|
.Nd joystick device driver
|
|
|
|
.Sh SYNOPSIS
|
2007-02-09 17:21:23 +00:00
|
|
|
To compile this driver into the kernel,
|
|
|
|
place the following lines in your
|
|
|
|
kernel configuration file:
|
|
|
|
.Bd -ragged -offset indent
|
|
|
|
.Cd "device joy"
|
|
|
|
.Ed
|
2000-11-02 14:23:53 +00:00
|
|
|
.Pp
|
2007-02-09 17:21:23 +00:00
|
|
|
Alternatively, to load the driver as a
|
|
|
|
module at boot time, place the following line in
|
|
|
|
.Xr loader.conf 5 :
|
|
|
|
.Bd -literal -offset indent
|
2007-02-12 20:58:32 +00:00
|
|
|
joy_load="YES"
|
2007-02-09 17:21:23 +00:00
|
|
|
.Ed
|
2000-11-02 14:23:53 +00:00
|
|
|
.Pp
|
2001-10-13 09:08:37 +00:00
|
|
|
In
|
2002-07-12 13:44:37 +00:00
|
|
|
.Pa /boot/device.hints :
|
2001-10-13 09:08:37 +00:00
|
|
|
.Cd hint.joy.0.at="isa"
|
|
|
|
.Cd hint.joy.0.port="0x201"
|
2005-11-11 12:53:37 +00:00
|
|
|
.Cd hint.joy.1.at="isa"
|
|
|
|
.Cd hint.joy.1.port="0x201"
|
2001-10-13 09:08:37 +00:00
|
|
|
.Pp
|
2002-03-26 16:05:14 +00:00
|
|
|
.In sys/joystick.h
|
1995-01-25 21:41:09 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The joystick device driver allows applications to read the status of
|
|
|
|
the PC joystick.
|
|
|
|
.Pp
|
|
|
|
This device may be opened by only one process at a time.
|
|
|
|
.Pp
|
1999-05-06 20:51:31 +00:00
|
|
|
The joystick status is read from a structure via a read()
|
2000-03-03 14:05:08 +00:00
|
|
|
call.
|
|
|
|
The structure is defined in the header file as follows:
|
1995-02-22 23:34:58 +00:00
|
|
|
.Pp
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
struct joystick {
|
|
|
|
int x; /* x position */
|
|
|
|
int y; /* y position */
|
|
|
|
int b1; /* button 1 status */
|
|
|
|
int b2; /* button 2 status */
|
|
|
|
};
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Positions are typically in the range 0-2000.
|
1995-01-25 21:41:09 +00:00
|
|
|
.Ss One line perl example:
|
2000-11-10 17:46:15 +00:00
|
|
|
.Bd -literal -compact
|
1995-01-25 21:41:09 +00:00
|
|
|
perl -e 'open(JOY,"/dev/joy0")||die;while(1)
|
|
|
|
{sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}'
|
2000-11-10 17:46:15 +00:00
|
|
|
.Ed
|
1995-01-25 21:41:09 +00:00
|
|
|
.Ss ioctl calls
|
2000-03-03 14:05:08 +00:00
|
|
|
Several ioctl() calls are also available.
|
|
|
|
They take an argument of
|
1995-01-25 21:41:09 +00:00
|
|
|
type int *
|
2001-07-14 19:41:16 +00:00
|
|
|
.Bl -tag -width JOY_SET_X_OFFSET
|
1995-12-09 17:31:08 +00:00
|
|
|
.It Dv JOY_SETTIMEOUT Fa int *limit
|
1995-01-25 21:41:09 +00:00
|
|
|
Set the time limit (in microseconds) for reading the joystick
|
2000-03-03 14:05:08 +00:00
|
|
|
status.
|
|
|
|
Setting a value
|
1995-01-25 21:41:09 +00:00
|
|
|
too small may prevent to get correct values for the positions (which
|
|
|
|
are then set to -2147483648), however this can be useful if one is
|
2001-07-14 19:41:16 +00:00
|
|
|
only interested by the buttons status.
|
1995-12-09 17:31:08 +00:00
|
|
|
.It Dv JOY_GETTIMEOUT Fa int *limit
|
1995-01-25 21:41:09 +00:00
|
|
|
Get the time limit (in microseconds) used for reading the joystick
|
2001-07-14 19:41:16 +00:00
|
|
|
status.
|
1995-01-25 21:41:09 +00:00
|
|
|
.It Dv JOY_SET_X_OFFSET Fa int *offset
|
2004-07-03 18:29:24 +00:00
|
|
|
Set the value to be added to the X position when reading the joystick
|
2001-07-14 19:41:16 +00:00
|
|
|
status.
|
1995-01-25 21:41:09 +00:00
|
|
|
.It Dv JOY_SET_Y_OFFSET Fa int *offset
|
2004-07-03 18:29:24 +00:00
|
|
|
Set the value to be added to the Y position when reading the joystick
|
2001-07-14 19:41:16 +00:00
|
|
|
status.
|
1995-01-25 21:41:09 +00:00
|
|
|
.It Dv JOY_GET_X_OFFSET Fa int *offset
|
2004-07-03 18:29:24 +00:00
|
|
|
Get the value which is added to the X position when reading the joystick
|
2001-07-14 19:41:16 +00:00
|
|
|
status.
|
1995-01-25 21:41:09 +00:00
|
|
|
.It Dv JOY_GET_Y_OFFSET Fa int *offset
|
2004-07-03 18:29:24 +00:00
|
|
|
Get the value which is added to the Y position when reading the joystick
|
2001-07-14 19:41:16 +00:00
|
|
|
status.
|
2000-12-29 09:18:45 +00:00
|
|
|
.El
|
1995-09-16 16:29:16 +00:00
|
|
|
.Sh TECHNICAL SPECIFICATIONS
|
|
|
|
The pinout of the DB-15 connector is as follow:
|
2001-01-19 14:15:40 +00:00
|
|
|
.Bd -literal
|
1995-09-16 16:29:16 +00:00
|
|
|
1 XY1 (+5v)
|
|
|
|
2 Switch 1
|
|
|
|
3 X1 (potentiometer #1)
|
|
|
|
4 Switch 1 (GND)
|
|
|
|
5 Switch 2 (GND)
|
|
|
|
6 Y1 (potentiometer #2)
|
|
|
|
7 Switch 2
|
|
|
|
8 N.C.
|
|
|
|
9 XY2 (+5v)
|
|
|
|
10 Switch 4
|
|
|
|
11 X2 (potentiometer #3)
|
|
|
|
12 Switch 3&4 (GND)
|
|
|
|
13 Y2 (potentiometer #4)
|
|
|
|
14 Switch 3
|
|
|
|
15 N.C.
|
2001-01-19 14:15:40 +00:00
|
|
|
.Ed
|
1995-09-16 16:29:16 +00:00
|
|
|
.Pp
|
|
|
|
Pots are normally 0-150k variable resistors (0-100k sometimes), and
|
2006-12-14 16:37:11 +00:00
|
|
|
according to the IBM technical reference, the time is given by
|
1995-09-16 16:29:16 +00:00
|
|
|
Time = 24.2e-6s + 0.011e-6s * R/Ohms
|
1995-01-25 21:41:09 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -width /dev/joy?
|
|
|
|
.It Pa /dev/joy?
|
|
|
|
joystick device files
|
2000-12-29 09:18:45 +00:00
|
|
|
.El
|
1995-01-25 21:41:09 +00:00
|
|
|
.Sh HISTORY
|
2007-02-09 17:21:23 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
driver appeared in
|
1996-08-21 22:01:49 +00:00
|
|
|
.Fx 2.0.5 .
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An Jean-Marc Zucconi Aq jmz@cabri.obs-besancon.fr
|