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