Return to BSD News archive
Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.hawaii.edu!ames!olivea!uunet!bcstec!galileo!dmp3592 From: dmp3592@galileo.rtn.ca.boeing.com (Dean M. Phillips) Newsgroups: comp.unix.bsd Subject: Re: [386BSD] Reading joystick port Message-ID: <1247@galileo.rtn.ca.boeing.com> Date: 3 Dec 92 22:25:14 GMT References: <jboyle.723341435@godzilla.cgl.citri.edu.au> <veit.723370235@du9ds3> Organization: Boeing Commercial Airplane Group, Seattle Lines: 47 In article <veit.723370235@du9ds3> veit@du9ds3.fb9dv.uni-duisburg.de writes: <In <jboyle.723341435@godzilla.cgl.citri.edu.au> jboyle@cgl.citri.edu.au (James Boyle) writes: < <<Hi, < <<I am writing a simulation program that uses the PC to read in values from the <<joystick port. These values then need to be sent over the network to an SGI <<IRIS that will perform the dynamics and display the graphics. < <<So I can use the socket facility, I would like the PC to run BSD. <<However, I don't know how to read joystick ports from a BSD process. <<Is this possible? And if so how? < <<Any help would be appreciated. <<Thanks in advance. < <<- James <<jboyle@godzilla.cgl.citri.edu.au < <[Info about privileged mode deleted] <The clean solution is a device driver, say /dev/game. You have to write <the necessary gameopen, gameclose, gameread, gameprobe, and gameattach <routines. See the various lpt drivers for hints (and read some books, <such as Bach, and Leiffler et al.) to understand the driver interface. <The problem with the game port is that it has no interrupt, so you need <some small code which periodically (internal kernel timer routines) <wakes up the driver to sample the game port (once each some milliseconds). < >Life is not easy. < <Holger Life is even harder than you think. A standard IBM game port is operated as follows: An output command triggers a measurement. To get the measurement you have to sit in a tight loop reading the input port and count the number of iterations until certain bits change. This is a VERY bad thing in a multitasking environment. Of course you could buy a real A/D converter card and connect the joystick to that and write a driver for it. You will still have to deal with the latencies in the socket mechanism. IBM: Incompatible Brain-damaged Machinery ;-) -- #include <standard_disclaimer.h> Dean M. Phillips (206) 393-9333 Boeing Commercial Airplane Group dmp3592@galileo.boeing.com