From 01ab76f4b88c3bef16dd110c008e8e246108c27c Mon Sep 17 00:00:00 2001 From: Jean-Marc Zucconi Date: Wed, 25 Jan 1995 21:41:09 +0000 Subject: [PATCH] Add joystick man page --- share/man/man4/joy.4 | 57 +++++++++++++++++++++++++++++++ share/man/man4/man4.i386/Makefile | 5 +-- share/man/man4/man4.i386/joy.4 | 57 +++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 share/man/man4/joy.4 create mode 100644 share/man/man4/man4.i386/joy.4 diff --git a/share/man/man4/joy.4 b/share/man/man4/joy.4 new file mode 100644 index 000000000000..70d148e8d196 --- /dev/null +++ b/share/man/man4/joy.4 @@ -0,0 +1,57 @@ +.Dd January 23, 1995 +.Dt JOY 4 +.Sh NAME +.Nm joy +.Nd joystick device driver +.Sh SYNOPSIS +.Cd device joy0 at isa? port "IO_GAME" +.Fd #include +.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 +The joystick status is get in an array of 4 integers via a read() +call. +.br +The X and Y positions are stored in values 0 and 1 of the array, +and the state of the 2 buttons are stores in values 2 and 3 of the +array. Positions are typically in the range 0-2000. +.Ss One line perl example: +perl -e 'open(JOY,"/dev/joy0")||die;while(1) +.br +{sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}' +.Ss ioctl calls +Several ioctl() calls are also available. They take an argument of +type int * +.Bl -tag -width JOY_SET_X_OFFSET +.It Dv JOY_SET_TIMEOUT Fa int *limit +Set the time limit (in microseconds) for reading the joystick +status. Setting a value +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 +only interested by the buttons status. +.It Dv JOY_GET_TIMEOUT Fa int *limit +Get the time limit (in microseconds) used for reading the joystick +status. +.It Dv JOY_SET_X_OFFSET Fa int *offset +Set the value to be added to the X position when reading the joystick +status. +.It Dv JOY_SET_Y_OFFSET Fa int *offset +Set the value to be added to the Y position when reading the joystick +status. +.It Dv JOY_GET_X_OFFSET Fa int *offset +Get the value which is added to the X position when reading the joystick +status. +.It Dv JOY_GET_Y_OFFSET Fa int *offset +Get the value which is added to the Y position when reading the joystick +status. +.Sh FILES +.Bl -tag -width /dev/joy? +.It Pa /dev/joy? +joystick device files +.Sh AUTHOR +Jean-Marc Zucconi +.Sh HISTORY +The joystick driver appeared in FreeBSD 2.1 diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile index 4735c47ae5e5..e7896ee40c6a 100644 --- a/share/man/man4/man4.i386/Makefile +++ b/share/man/man4/man4.i386/Makefile @@ -1,7 +1,7 @@ # @(#)Makefile 0.1 (RWGrimes) 3/25/93 -MAN4= aha.4 ahb.4 bt.4 cx.4 ed.4 fdc.4 ie.4 is.4 keyboard.4 lpt.4 mcd.4 \ - mem.4 mse.4 npx.4 screen.4 sio.4 spkr.4 tw.4 uha.4 wd.4 +MAN4= aha.4 ahb.4 bt.4 cx.4 ed.4 fdc.4 ie.4 is.4 joy.4 keyboard.4 lpt.4 \ + mcd.4 mem.4 mse.4 npx.4 screen.4 sio.4 spkr.4 tw.4 uha.4 wd.4 MLINKS= aha.4 ../aha.4 MLINKS+= ahb.4 ../ahb.4 @@ -11,6 +11,7 @@ MLINKS+= ed.4 ../ed.4 MLINKS+= fdc.4 ../fdc.4 MLINKS+= ie.4 ../ie.4 MLINKS+= is.4 ../is.4 +MLINKS+= joy.4 ../joy.4 MLINKS+= keyboard.4 ../keyboard.4 MLINKS+= lpt.4 ../lpt.4 MLINKS+= mcd.4 ../mcd.4 diff --git a/share/man/man4/man4.i386/joy.4 b/share/man/man4/man4.i386/joy.4 new file mode 100644 index 000000000000..70d148e8d196 --- /dev/null +++ b/share/man/man4/man4.i386/joy.4 @@ -0,0 +1,57 @@ +.Dd January 23, 1995 +.Dt JOY 4 +.Sh NAME +.Nm joy +.Nd joystick device driver +.Sh SYNOPSIS +.Cd device joy0 at isa? port "IO_GAME" +.Fd #include +.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 +The joystick status is get in an array of 4 integers via a read() +call. +.br +The X and Y positions are stored in values 0 and 1 of the array, +and the state of the 2 buttons are stores in values 2 and 3 of the +array. Positions are typically in the range 0-2000. +.Ss One line perl example: +perl -e 'open(JOY,"/dev/joy0")||die;while(1) +.br +{sysread(JOY,$x,16);@j=unpack("iiii",$x);print "@j\\n";sleep(1);}' +.Ss ioctl calls +Several ioctl() calls are also available. They take an argument of +type int * +.Bl -tag -width JOY_SET_X_OFFSET +.It Dv JOY_SET_TIMEOUT Fa int *limit +Set the time limit (in microseconds) for reading the joystick +status. Setting a value +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 +only interested by the buttons status. +.It Dv JOY_GET_TIMEOUT Fa int *limit +Get the time limit (in microseconds) used for reading the joystick +status. +.It Dv JOY_SET_X_OFFSET Fa int *offset +Set the value to be added to the X position when reading the joystick +status. +.It Dv JOY_SET_Y_OFFSET Fa int *offset +Set the value to be added to the Y position when reading the joystick +status. +.It Dv JOY_GET_X_OFFSET Fa int *offset +Get the value which is added to the X position when reading the joystick +status. +.It Dv JOY_GET_Y_OFFSET Fa int *offset +Get the value which is added to the Y position when reading the joystick +status. +.Sh FILES +.Bl -tag -width /dev/joy? +.It Pa /dev/joy? +joystick device files +.Sh AUTHOR +Jean-Marc Zucconi +.Sh HISTORY +The joystick driver appeared in FreeBSD 2.1