~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux-2.6.17/Documentation/input/joystick-parport.txt

Version: ~ [ 2.6.16 ] ~ [ 2.6.17 ] ~
Architecture: ~ [ ia64 ] ~ [ i386 ] ~ [ arm ] ~ [ ppc ] ~ [ sparc64 ] ~

  1                     Linux Joystick parport drivers v2.0
  2                (c) 1998-2000 Vojtech Pavlik <vojtech@ucw.cz>
  3                (c) 1998 Andree Borrmann <a.borrmann@tu-bs.de>
  4                              Sponsored by SuSE
  5         $Id: joystick-parport.txt,v 1.6 2001/09/25 09:31:32 vojtech Exp $
  6 ----------------------------------------------------------------------------
  7 
  8 0. Disclaimer
  9 ~~~~~~~~~~~~~
 10   Any information in this file is provided as-is, without any guarantee that
 11 it will be true. So, use it at your own risk. The possible damages that can
 12 happen include burning your parallel port, and/or the sticks and joystick
 13 and maybe even more. Like when a lightning kills you it is not our problem.
 14 
 15 1. Intro
 16 ~~~~~~~~
 17   The joystick parport drivers are used for joysticks and gamepads not
 18 originally designed for PCs and other computers Linux runs on. Because of
 19 that, PCs usually lack the right ports to connect these devices to. Parallel
 20 port, because of its ability to change single bits at will, and providing
 21 both output and input bits is the most suitable port on the PC for
 22 connecting such devices.
 23 
 24 2. Devices supported
 25 ~~~~~~~~~~~~~~~~~~~~
 26   Many console and 8-bit computer gamepads and joysticks are supported. The
 27 following subsections discuss usage of each.
 28 
 29 2.1 NES and SNES
 30 ~~~~~~~~~~~~~~~~
 31   The Nintendo Entertainment System and Super Nintendo Entertainment System
 32 gamepads are widely available, and easy to get. Also, they are quite easy to
 33 connect to a PC, and don't need much processing speed (108 us for NES and
 34 165 us for SNES, compared to about 1000 us for PC gamepads) to communicate
 35 with them.
 36 
 37   All NES and SNES use the same synchronous serial protocol, clocked from
 38 the computer's side (and thus timing insensitive). To allow up to 5 NES
 39 and/or SNES gamepads and/or SNES mice connected to the parallel port at once,
 40 the output lines of the parallel port are shared, while one of 5 available
 41 input lines is assigned to each gamepad.
 42 
 43   This protocol is handled by the gamecon.c driver, so that's the one
 44 you'll use for NES, SNES gamepads and SNES mice.
 45 
 46   The main problem with PC parallel ports is that they don't have +5V power
 47 source on any of their pins. So, if you want a reliable source of power
 48 for your pads, use either keyboard or joystick port, and make a pass-through
 49 cable. You can also pull the power directly from the power supply (the red
 50 wire is +5V).
 51 
 52   If you want to use the parallel port only, you can take the power is from
 53 some data pin. For most gamepad and parport implementations only one pin is
 54 needed, and I'd recommend pin 9 for that, the highest data bit. On the other
 55 hand, if you are not planning to use anything else than NES / SNES on the
 56 port, anything between and including pin 4 and pin 9 will work.
 57 
 58 (pin 9) -----> Power
 59 
 60   Unfortunately, there are pads that need a lot more of power, and parallel
 61 ports that can't give much current through the data pins. If this is your
 62 case, you'll need to use diodes (as a prevention of destroying your parallel
 63 port), and combine the currents of two or more data bits together.
 64 
 65            Diodes
 66 (pin 9) ----|>|-------+------> Power
 67                       |
 68 (pin 8) ----|>|-------+
 69                       |
 70 (pin 7) ----|>|-------+
 71                       |
 72  <and so on>          :
 73                       |
 74 (pin 4) ----|>|-------+
 75 
 76   Ground is quite easy. On PC's parallel port the ground is on any of the
 77 pins from pin 18 to pin 25. So use any pin of these you like for the ground.
 78 
 79 (pin 18) -----> Ground
 80 
 81   NES and SNES pads have two input bits, Clock and Latch, which drive the
 82 serial transfer. These are connected to pins 2 and 3 of the parallel port,
 83 respectively.
 84 
 85 (pin 2) -----> Clock
 86 (pin 3) -----> Latch
 87 
 88   And the last thing is the NES / SNES data wire. Only that isn't shared and
 89 each pad needs its own data pin. The parallel port pins are:
 90 
 91 (pin 10) -----> Pad 1 data
 92 (pin 11) -----> Pad 2 data
 93 (pin 12) -----> Pad 3 data
 94 (pin 13) -----> Pad 4 data
 95 (pin 15) -----> Pad 5 data
 96 
 97   Note that pin 14 is not used, since it is not an input pin on the parallel
 98 port.
 99 
100   This is everything you need on the PC's side of the connection, now on to
101 the gamepads side. The NES and SNES have different connectors. Also, there
102 are quite a lot of NES clones, and because Nintendo used proprietary
103 connectors for their machines, the cloners couldn't and used standard D-Cannon
104 connectors. Anyway, if you've got a gamepad, and it has buttons A, B, Turbo
105 A, Turbo B, Select and Start, and is connected through 5 wires, then it is
106 either a NES or NES clone and will work with this connection. SNES gamepads
107 also use 5 wires, but have more buttons. They will work as well, of course.
108 
109 Pinout for NES gamepads                 Pinout for SNES gamepads and mice
110 
111            +----> Power                   +-----------------------\
112            |                            7 | o  o  o  o |  x  x  o  | 1
113  5 +---------+  7                         +-----------------------/
114    | x  x  o   \                            |  |  |  |          |
115    | o  o  o  o |                           |  |  |  |          +-> Ground
116  4 +------------+ 1                         |  |  |  +------------> Data
117      |  |  |  |                             |  |  +---------------> Latch
118      |  |  |  +-> Ground                    |  +------------------> Clock
119      |  |  +----> Clock                     +---------------------> Power
120      |  +-------> Latch
121      +----------> Data
122 
123 Pinout for NES clone (db9) gamepads     Pinout for NES clone (db15) gamepads
124 
125         +---------> Clock                    +-----------------> Data
126         | +-------> Latch                    |             +---> Ground
127         | | +-----> Data                     |             |
128         | | |                              ___________________
129     _____________                        8 \ o x x x x x x o / 1
130   5 \ x o o o x / 1                         \ o x x o x x o /
131      \ x o x o /                          15 `~~~~~~~~~~~~~' 9
132     9 `~~~~~~~' 6                             |     |     |
133          |   |                                |     |     +----> Clock
134          |   +----> Power                     |     +----------> Latch
135          +--------> Ground                    +----------------> Power
136 
137 2.2 Multisystem joysticks
138 ~~~~~~~~~~~~~~~~~~~~~~~~~
139   In the era of 8-bit machines, there was something like de-facto standard
140 for joystick ports. They were all digital, and all used D-Cannon 9 pin
141 connectors (db9). Because of that, a single joystick could be used without
142 hassle on Atari (130, 800XE, 800XL, 2600, 7200), Amiga, Commodore C64,
143 Amstrad CPC, Sinclair ZX Spectrum and many other machines. That's why these
144 joysticks are called "Multisystem".
145 
146   Now their pinout:
147 
148       +---------> Right
149       | +-------> Left
150       | | +-----> Down
151       | | | +---> Up
152       | | | |
153   _____________
154 5 \ x o o o o / 1
155    \ x o x o /
156   9 `~~~~~~~' 6
157        |   |
158        |   +----> Button
159        +--------> Ground
160 
161   However, as time passed, extensions to this standard developed, and these
162 were not compatible with each other:
163 
164 
165         Atari 130, 800/XL/XE               MSX
166 
167                                          +-----------> Power
168       +---------> Right                  | +---------> Right
169       | +-------> Left                   | | +-------> Left
170       | | +-----> Down                   | | | +-----> Down
171       | | | +---> Up                     | | | | +---> Up
172       | | | |                            | | | | |
173   _____________                        _____________
174 5 \ x o o o o / 1                    5 \ o o o o o / 1
175    \ x o o o /                          \ o o o o /
176   9 `~~~~~~~' 6                        9 `~~~~~~~' 6
177        | | |                              | | | |
178        | | +----> Button                  | | | +----> Button 1
179        | +------> Power                   | | +------> Button 2
180        +--------> Ground                  | +--------> Output 3
181                                           +----------> Ground
182 
183         Amstrad CPC                        Commodore C64
184 
185                                          +-----------> Analog Y
186       +---------> Right                  | +---------> Right
187       | +-------> Left                   | | +-------> Left
188       | | +-----> Down                   | | | +-----> Down
189       | | | +---> Up                     | | | | +---> Up
190       | | | |                            | | | | |
191   _____________                        _____________
192 5 \ x o o o o / 1                    5 \ o o o o o / 1
193    \ x o o o /                          \ o o o o /
194   9 `~~~~~~~' 6                        9 `~~~~~~~' 6
195        | | |                              | | | |
196        | | +----> Button 1                | | | +----> Button
197        | +------> Button 2                | | +------> Power
198        +--------> Ground                  | +--------> Ground
199                                           +----------> Analog X
200 
201         Sinclair Spectrum +2A/+3           Amiga 1200
202                                      
203     +-----------> Up                     +-----------> Button 3
204     | +---------> Fire                   | +---------> Right
205     | |                                  | | +-------> Left
206     | |   +-----> Ground                 | | | +-----> Down
207     | |   |                              | | | | +---> Up
208     | |   |                              | | | | |
209   _____________                        _____________
210 5 \ o o x o x / 1                    5 \ o o o o o / 1
211    \ o o o o /                          \ o o o o /
212   9 `~~~~~~~' 6                        9 `~~~~~~~' 6
213      | | | |                              | | | |
214      | | | +----> Right                   | | | +----> Button 1
215      | | +------> Left                    | | +------> Power
216      | +--------> Ground                  | +--------> Ground
217      +----------> Down                    +----------> Button 2
218 
219   And there were many others.
220 
221 2.2.1 Multisystem joysticks using db9.c
222 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223   For the Multisystem joysticks, and their derivatives, the db9.c driver
224 was written. It allows only one joystick / gamepad per parallel port, but
225 the interface is easy to build and works with almost anything.
226 
227   For the basic 1-button Multisystem joystick you connect its wires to the
228 parallel port like this:
229 
230 (pin  1) -----> Power
231 (pin 18) -----> Ground
232 
233 (pin  2) -----> Up
234 (pin  3) -----> Down
235 (pin  4) -----> Left
236 (pin  5) -----> Right
237 (pin  6) -----> Button 1
238 
239   However, if the joystick is switch based (eg. clicks when you move it),
240 you might or might not, depending on your parallel port, need 10 kOhm pullup
241 resistors on each of the direction and button signals, like this:
242 
243 (pin 2) ------------+------> Up
244           Resistor  |
245 (pin 1) --[10kOhm]--+
246 
247   Try without, and if it doesn't work, add them. For TTL based joysticks /
248 gamepads the pullups are not needed.
249 
250   For joysticks with two buttons you connect the second button to pin 7 on
251 the parallel port.
252 
253 (pin 7) -----> Button 2
254 
255   And that's it.
256 
257   On a side note, if you have already built a different adapter for use with
258 the digital joystick driver 0.8.0.2, this is also supported by the db9.c
259 driver, as device type 8. (See section 3.2)
260 
261 2.2.2 Multisystem joysticks using gamecon.c
262 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263   For some people just one joystick per parallel port is not enough, and/or
264 want to use them on one parallel port together with NES/SNES/PSX pads. This is
265 possible using the gamecon.c. It supports up to 5 devices of the above types,
266 including 1 and 2 buttons Multisystem joysticks.
267 
268   However, there is nothing for free. To allow more sticks to be used at
269 once, you need the sticks to be purely switch based (that is non-TTL), and
270 not to need power. Just a plain simple six switches inside. If your
271 joystick can do more (eg. turbofire) you'll need to disable it totally first
272 if you want to use gamecon.c.
273 
274   Also, the connection is a bit more complex. You'll need a bunch of diodes,
275 and one pullup resistor. First, you connect the Directions and the button
276 the same as for db9, however with the diodes inbetween.
277 
278             Diodes
279 (pin 2) -----|<|----> Up
280 (pin 3) -----|<|----> Down
281 (pin 4) -----|<|----> Left
282 (pin 5) -----|<|----> Right
283 (pin 6) -----|<|----> Button 1
284 
285   For two button sticks you also connect the other button.
286 
287 (pin 7) -----|<|----> Button 2
288 
289   And finally, you connect the Ground wire of the joystick, like done in
290 this little schematic to Power and Data on the parallel port, as described
291 for the NES / SNES pads in section 2.1 of this file - that is, one data pin
292 for each joystick. The power source is shared.
293 
294 Data    ------------+-----> Ground
295           Resistor  |
296 Power   --[10kOhm]--+
297 
298   And that's all, here we go!
299 
300 2.2.3 Multisystem joysticks using turbografx.c
301 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302   The TurboGraFX interface, designed by
303 
304         Steffen Schwenke <schwenke@burg-halle.de>
305 
306   allows up to 7 Multisystem joysticks connected to the parallel port. In
307 Steffen's version, there is support for up to 5 buttons per joystick.  However,
308 since this doesn't work reliably on all parallel ports, the turbografx.c driver
309 supports only one button per joystick. For more information on how to build the
310 interface, see
311 
312         http://www2.burg-halle.de/~schwenke/parport.html
313 
314 2.3 Sony Playstation
315 ~~~~~~~~~~~~~~~~~~~~
316 
317   The PSX controller is supported by the gamecon.c. Pinout of the PSX
318 controller (compatible with DirectPadPro):
319 
320   +---------+---------+---------+
321 9 | o  o  o | o  o  o | o  o  o | 1               parallel
322    \________|_________|________/                  port pins
323     |  |      |  |  |   |
324     |  |      |  |  |   +-------->  Clock    ---  (4)
325     |  |      |  |  +------------>  Select   ---  (3)
326     |  |      |  +--------------->  Power    ---  (5-9)
327     |  |      +------------------>  Ground   ---  (18-25)
328     |  +------------------------->  Command  ---  (2)
329     +---------------------------->  Data     ---  (one of 10,11,12,13,15)
330 
331   The driver supports these controllers:
332 
333  * Standard PSX Pad
334  * NegCon PSX Pad
335  * Analog PSX Pad (red mode)
336  * Analog PSX Pad (green mode)
337  * PSX Rumble Pad
338  * PSX DDR Pad
339 
340 2.4 Sega
341 ~~~~~~~~
342   All the Sega controllers are more or less based on the standard 2-button
343 Multisystem joystick. However, since they don't use switches and use TTL
344 logic, the only driver usable with them is the db9.c driver.
345 
346 2.4.1 Sega Master System
347 ~~~~~~~~~~~~~~~~~~~~~~~~
348   The SMS gamepads are almost exactly the same as normal 2-button
349 Multisystem joysticks. Set the driver to Multi2 mode, use the corresponding
350 parallel port pins, and the following schematic:
351 
352     +-----------> Power
353     | +---------> Right
354     | | +-------> Left
355     | | | +-----> Down
356     | | | | +---> Up
357     | | | | |
358   _____________
359 5 \ o o o o o / 1
360    \ o o x o /
361   9 `~~~~~~~' 6
362      | |   |
363      | |   +----> Button 1
364      | +--------> Ground
365      +----------> Button 2
366 
367 2.4.2 Sega Genesis aka MegaDrive
368 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
369   The Sega Genesis (in Europe sold as Sega MegaDrive) pads are an extension
370 to the Sega Master System pads. They use more buttons (3+1, 5+1, 6+1).  Use
371 the following schematic:
372 
373     +-----------> Power
374     | +---------> Right
375     | | +-------> Left
376     | | | +-----> Down
377     | | | | +---> Up
378     | | | | |
379   _____________
380 5 \ o o o o o / 1
381    \ o o o o /
382   9 `~~~~~~~' 6
383      | | | |
384      | | | +----> Button 1
385      | | +------> Select
386      | +--------> Ground
387      +----------> Button 2
388 
389   The Select pin goes to pin 14 on the parallel port.
390 
391 (pin 14) -----> Select
392 
393   The rest is the same as for Multi2 joysticks using db9.c
394 
395 2.4.3 Sega Saturn
396 ~~~~~~~~~~~~~~~~~
397   Sega Saturn has eight buttons, and to transfer that, without hacks like
398 Genesis 6 pads use, it needs one more select pin. Anyway, it is still
399 handled by the db9.c driver. Its pinout is very different from anything
400 else.  Use this schematic:
401 
402     +-----------> Select 1
403     | +---------> Power
404     | | +-------> Up
405     | | | +-----> Down
406     | | | | +---> Ground
407     | | | | |
408   _____________
409 5 \ o o o o o / 1
410    \ o o o o /
411   9 `~~~~~~~' 6
412      | | | |
413      | | | +----> Select 2
414      | | +------> Right
415      | +--------> Left
416      +----------> Power
417 
418   Select 1 is pin 14 on the parallel port, Select 2 is pin 16 on the
419 parallel port.
420 
421 (pin 14) -----> Select 1
422 (pin 16) -----> Select 2
423 
424   The other pins (Up, Down, Right, Left, Power, Ground) are the same as for
425 Multi joysticks using db9.c
426 
427 3. The drivers
428 ~~~~~~~~~~~~~~
429   There are three drivers for the parallel port interfaces. Each, as
430 described above, allows to connect a different group of joysticks and pads.
431 Here are described their command lines:
432 
433 3.1 gamecon.c
434 ~~~~~~~~~~~~~
435   Using gamecon.c you can connect up to five devices to one parallel port. It
436 uses the following kernel/module command line:
437 
438         gamecon.map=port,pad1,pad2,pad3,pad4,pad5
439 
440   Where 'port' the number of the parport interface (eg. 0 for parport0).
441 
442   And 'pad1' to 'pad5' are pad types connected to different data input pins
443 (10,11,12,13,15), as described in section 2.1 of this file.
444 
445   The types are:
446 
447         Type | Joystick/Pad
448         --------------------
449           0  | None
450           1  | SNES pad
451           2  | NES pad
452           4  | Multisystem 1-button joystick
453           5  | Multisystem 2-button joystick
454           6  | N64 pad
455           7  | Sony PSX controller
456           8  | Sony PSX DDR controller
457           9  | SNES mouse
458 
459   The exact type of the PSX controller type is autoprobed when used so
460 hot swapping should work (but is not recomended).
461 
462   Should you want to use more than one of parallel ports at once, you can use
463 gamecon.map2 and gamecon.map3 as additional command line parameters for two
464 more parallel ports.
465 
466   There are two options specific to PSX driver portion.  gamecon.psx_delay sets
467 the command delay when talking to the controllers. The default of 25 should
468 work but you can try lowering it for better performace. If your pads don't
469 respond try raising it untill they work. Setting the type to 8 allows the
470 driver to be used with Dance Dance Revolution or similar games. Arrow keys are
471 registered as key presses instead of X and Y axes.
472 
473 3.2 db9.c
474 ~~~~~~~~~
475   Apart from making an interface, there is nothing difficult on using the
476 db9.c driver. It uses the following kernel/module command line:
477 
478         db9.dev=port,type
479 
480   Where 'port' is the number of the parport interface (eg. 0 for parport0).
481 
482   Caveat here: This driver only works on bidirectional parallel ports. If
483 your parallel port is recent enough, you should have no trouble with this.
484 Old parallel ports may not have this feature.
485 
486   'Type' is the type of joystick or pad attached:
487 
488         Type | Joystick/Pad
489         --------------------
490           0  | None
491           1  | Multisystem 1-button joystick
492           2  | Multisystem 2-button joystick
493           3  | Genesis pad (3+1 buttons)
494           5  | Genesis pad (5+1 buttons)
495           6  | Genesis pad (6+2 buttons)
496           7  | Saturn pad (8 buttons)
497           8  | Multisystem 1-button joystick (v0.8.0.2 pin-out)
498           9  | Two Multisystem 1-button joysticks (v0.8.0.2 pin-out) 
499          10  | Amiga CD32 pad
500 
501   Should you want to use more than one of these joysticks/pads at once, you
502 can use db9.dev2 and db9.dev3 as additional command line parameters for two
503 more joysticks/pads.
504 
505 3.3 turbografx.c
506 ~~~~~~~~~~~~~~~~
507   The turbografx.c driver uses a very simple kernel/module command line:
508 
509         turbografx.map=port,js1,js2,js3,js4,js5,js6,js7
510 
511   Where 'port' is the number of the parport interface (eg. 0 for parport0).
512 
513   'jsX' is the number of buttons the Multisystem joysticks connected to the
514 interface ports 1-7 have. For a standard multisystem joystick, this is 1.
515 
516   Should you want to use more than one of these interfaces at once, you can
517 use turbografx.map2 and turbografx.map3 as additional command line parameters
518 for two more interfaces.
519 
520 3.4 PC parallel port pinout
521 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
522                   .----------------------------------------.
523    At the PC:     \ 13 12 11 10  9  8  7  6  5  4  3  2  1 /
524                    \  25 24 23 22 21 20 19 18 17 16 15 14 /
525                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
526 
527           Pin | Name    | Description
528         ~~~~~~|~~~~~~~~~|~~~~~~~~~~
529             1 | /STROBE | Strobe
530           2-9 | D0-D7   | Data Bit 0-7
531            10 | /ACK    | Acknowledge
532            11 | BUSY    | Busy
533            12 | PE      | Paper End
534            13 | SELIN   | Select In
535            14 | /AUTOFD | Autofeed
536            15 | /ERROR  | Error
537            16 | /INIT   | Initialize
538            17 | /SEL    | Select
539         18-25 | GND     | Signal Ground
540 
541 3.5 End
542 ~~~~~~~
543   That's all, folks! Have fun!

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.