*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> i386/joy (4)              
Title
Content
Arch
Section
 

JOY(4)

Contents


NAME    [Toc]    [Back]

     joy - Games adapter driver

SYNOPSIS    [Toc]    [Back]

     joy0 at isa? port 0x201
     joy* at isapnp?

DESCRIPTION    [Toc]    [Back]

     This driver provides access to the games adapter.  The lower
bit in the
     minor  device  number  selects  the joystick: 0 is the first
joystick and 1
     is the second.

     The game control adapter allows up to two  joysticks  to  be
attached to the
     system.  The adapter plus the driver convert the present resistive value
     to a relative joystick position.  On receipt  of  an  output
signal, four
     timing  circuits  are  started.  By determining the time required for the
     circuit to time-out (a function of the resistance), the paddle position
     can  be  determined.  The adapter could be used as a general
purpose I/O
     card with four analog (resistive) inputs plus  four  digital
input points.

     Applications  may call ioctl() on a game adapter driver file
descriptor to
     set and get the offsets of the two  potentiometers  and  the
maximum timeout
  value for the circuit.  The ioctl() commands are listed
in
     <machine/joystick.h> and currently are:

           JOY_SETTIMEOUT    Sets the maximum  time-out  for  the
adapter.
           JOY_GETTIMEOUT     Returns  the  current maximum timeout.
           JOY_SET_X_OFFSET  Sets an offset on X value.
           JOY_GET_X_OFFSET  Returns the current X offset.
           JOY_SET_Y_OFFSET  Sets an offset on Y value.
           JOY_GET_Y_OFFSET  Returns the current Y offset.

     All of these commands take an integer parameter.

     Read() on the file descriptor returns a joystick structure:

           struct joystick {
                   int x;
                   int y;
                   int b1;
                   int b2;
           };

     The fields have the following functions:

           x    Joystick's current X coordinate (or  position  of
paddle 1).
           y     Joystick's  current Y coordinate (or position of
paddle 2).
           b1   Current state of button 1.
           b2   Current state of button 2.

     The b1 and b2 fields in struct joystick are set to 1 if  the
corresponding
     button is down, or 0 otherwise.

     The X and Y coordinates are supposed to be between 0 and 255
for a good
     joystick and a good adapter.  Unfortunately, because of  the
hardware hack
     that  is used to measure the position (by measuring the time
needed to
     discharge an RC circuit made from the joystick's potentiometer and a capacitor
  on the adapter), calibration is needed to determine
exactly what
     values are returned for a specific joystick/adapter combination.  Incorrect
 hardware can yield negative or > 255 values.

     A  typical calibration procedure uses the values returned at
lower-left,
     center, and upper-right positions of the joystick to compute
the relative
     position.

     This calibration is not part of the driver.

FILES    [Toc]    [Back]

     /dev/joy0  first joystick
     /dev/joy1  second joystick

SEE ALSO    [Toc]    [Back]

      
      
     ioctl(2), intro(4), isa(4), isapnp(4)

AUTHORS    [Toc]    [Back]

     Jean-Marc  Zucconi wrote the FreeBSD driver.  Matthieu Herrb
ported it to
     OpenBSD and wrote this manual page.

OpenBSD     3.6                         January      7,      1996
[ Back ]
 Similar pages
Name OS Title
iop OpenBSD I2O (RAID) adapter driver
lmc FreeBSD LAN Media Corp. PCI WAN adapter driver
uha OpenBSD Ultrastor SCSI adapter driver
bha OpenBSD Buslogic SCSI adapter driver
pcdisplay OpenBSD PC display adapter driver for wscons
aha FreeBSD Adaptec SCSI host adapter driver
dpt OpenBSD DPT EATA SCSI RAID adapter driver
ahb OpenBSD Adaptec 1742 SCSI adapter driver
aha OpenBSD Adaptec 154x SCSI adapter driver
twe FreeBSD 3ware Escalade ATA RAID adapter driver
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service