Copyright 2006 @ David Colmenero
http://david.dantoine.org - [ VOLVER ]
Este contenido:
NO puede ser usado para fines comerciales. NO puede ser modicado/suplantado el autor original de la obra.
Por favor visita mi página personal para un conocer el tipo de licencia actual.
English Version below!
Crear un driver totalmente opensource que permita usar el puerto paralelo para nuestros controles; en principio yo voy a trabajar en Linux, pero al ser el driver abierto, si alquien quiere portarlo a MSDOS, MacOS o Windows; es perfectamente libre de hacerlo 
El objetivo inicial va a ser hacer un simple keycoder por software (la pulsacion de un boton te da una tecla) y un soporte basico para joystick virtuales (de 8 botones y 2 ejes).
En este momento el driver aunque no es configurable, es totalmente funcional, siempre que prepareis un panel para el... que ademas (supongo) que tambien seria compatible con la version oficial de PPjoy :?
Antes de comenzar:
- Aconsejo mirar antes el tutorial de PPjoy en Marcianitos.net
http://www.marcianitos.org/tutoriales/IC018.htm (archive.org)
- Mas informacion sobre el driver y soporte, en el topic original:
http://www.forumcommunity.net/?t=2173834
Con PPJoy se configuran los botones por lineas, tal que asi:
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-ARRIB ][ 1-ABAJO ][ 1-DEREC ][ 1-IZQUI ][ 1-DISP1 ] [ 3 ][ 1-DISP2 ][ 1-DISP3 ][ 1-DISP4 ][ 1-DISP5 ][ 1-DISP6 ] [ 4 ][ ][ ][ ][ ][ ] [ 5 ][ ][ ][ ][ ][ ] [ 6 ][ ][ ][ ][ ][ ] [ 7 ][ ][ ][ ][ ][ ] [ 8 ][ 2-ARRIB ][ 2-ABAJO ][ 2-DEREC ][ 2-IZQUI ][ 2-DISP1 ] [ 9 ][ 2-DISP2 ][ 2-DISP3 ][ 2-DISP4 ][ 2-DISP5 ][ 2-DISP6 ] [ 1 ][ ][ ][ ][ ][ ] [ 14 ][ ][ ][ ][ ][ ] [ 16 ][ ][ ][ ][ ][ ] [ 17 ][ ][ ][ ][ ][ ]
Pero con OpenPPJoy, para simplificar su programacion decidi que se configurarian los controles por columnas:
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-ARRIB ][ 2-ARRIB ][ ][ ][ ] [ 3 ][ 1-ABAJO ][ 2-ABAJO ][ ][ ][ ] [ 4 ][ 1-DEREC ][ 2-DEREC ][ ][ ][ ] [ 5 ][ 1-IZQUI ][ 2-IZQUI ][ ][ ][ ] [ 6 ][ 1-DISP1 ][ 2-DISP1 ][ ][ ][ ] [ 7 ][ 1-DISP2 ][ 2-DISP2 ][ ][ ][ ] [ 8 ][ 1-DISP3 ][ 2-DISP3 ][ ][ ][ ] [ 9 ][ 1-DISP4 ][ 2-DISP4 ][ ][ ][ ] [ 1 ][ 1-DISP5 ][ 2-DISP5 ][ ][ ][ ] [ 14 ][ 1-DISP6 ][ 2-DISP6 ][ ][ ][ ] [ 16 ][ 1-DISP7 ][ 2-DISP7 ][ ][ ][ ] [ 17 ][ 1-DISP8 ][ 2-DISP8 ][ ][ ][ ]
[IMAGEN-TODO]
De esta forma tendriamos solo que mirar el numero de columnas/controles activos, y no tener que esperar mas de lo necesario. Si habeis leido los enlaces anteriores, vereis que la implementacion de este driver en paneles de control arcade es muy simple, os dejo un esquema para un mando arcade:
ATENCIÓN: Estos esquemas estan pendientes de actualizar, mejor mirad
los esquemas de marcianitos (link arriba), teniendo en cuenta que
nosotros trabajamos en columnas y ellos en filas.
#JOY1
|--@---(2)
|--@---(3)
|--@---(4)
|--@---(5)
L10-[ diodo ]---------------------|--@---(6)
|--@---(7)
|--@---(8)
|--@---(9)
|--@---(1)
|--@---(14)
|--@---(16)
|--@---(17)
Leyenda: @ - Botones, configurados en: "normalmente desconectados".
(n) - Lineas de datos.
lnn - Lineas de lectura.
O lo que es lo mismo:
[IMAGEN1-TODO]
Y asi podriais seguir usando las siguientes lineas disponibles (11,12,13,15). Por si alguno aun no lo tiene claro, pongo un ejemplo final con 2 palancas:
ATENCIÓN: Estos esquemas estan pendientes de actualizar, mejor mirad
los esquemas de marcianitos (link arriba), teniendo en cuenta que
nosotros trabajamos en columnas y ellos en filas.
#JOY1
|--@---(2)
|--@---(3)
|--@---(4)
|--@---(5)
L10-[ diodo ]---------------------|--@---(6)
|--@---(7)
|--@---(8)
|--@---(9)
|--@---(1)
|--@---(14)
|--@---(16)
|--@---(17)
#JOY2
|--@---(2)
|--@---(3)
|--@---(4)
|--@---(5)
L11-[ diodo ]---------------------|--@---(6)
|--@---(7)
|--@---(8)
|--@---(9)
|--@---(1)
|--@---(14)
|--@---(16)
|--@---(17)
Leyenda: @ - Botones, configurados en: "normalmente desconectados".
(n) - Lineas de datos.
lnn - Lineas de lectura.
O siguiendo los esquemas anteriores hacemos:
[IMAGEN2-TODO]
En total podriais tener 5 palancas de 8 botones o 3 palancas y las dos configuraciones de teclado basicas, etc... imaginacion al poder! xD
(1) JOYSTICK: 2 ejes y 8 botones.
TECLADO:
(2) KEY1 - CURSOR_UP
CURSOR_DOWN
CURSOR_LEFT
CURSOR_RIGHT
CURSOR_SPACE
LEFT_CONTROL
LEFT_SHIFT
LEFT_ALT
ESC
ENTER
[5]
[1]
(3) KEY2 - [W]
[S]
[A]
[D]
[Q]
[E]
[Z]
[X]
[C]
[V]
[6]
[2]
Para instalar el driver necesitas las cabeceras (HEADERS) del kernel que esteis usando actualmente por ejemplo en debian/ubuntu seria:
# apt-get install linux-headers-`uname -r`
Una vez instalados las cabeceras (o mismo source completo si lo deseas), hacemos:
# make
Si todo ha terminado bien, tendriamos que tener un arcade.ko en el directorio donde compilaste el modulo. Ahora vamos a explicar como "map=" configura el driver a nuestro gusto:
map=x,y1,y2,y3,y4,y5
La [x] define el puerto paralelo a usar, en la mayoria de los casos sera 0.
La [yN] define el numero del tipo de control que deseamos usar de la siguiente
lista:
1 - Palanca de 8 botones
2 - Key config 1 (ver arriba)
3 - Key config 2 (ver arriba)
Unos ejemplos finales, teniendo en cuenta que "insmod" es para cargar el modulo y que "arcade.ko" seria el modulo (si aun teneis dudas, buscad por ahi tutoriales que sobre estos temas hay muchos!! :P
# insmod arcade.ko map=0,1
Y con esto tendriamos una palanca de 8 botones que lee la linea 10...
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-ARRIB ][ ][ ][ ][ ] [ 3 ][ 1-ABAJO ][ ][ ][ ][ ] ....
Si hubieramos hecho:
# insmod arcade.ko map=0,1,1,1,1,1
Tendriamos 5 palancas de 8 botones que leen las lineas: 10,11,12,13,15 
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-ARRIB ][ 2-ARRIB ][ 3-ARRIB ][ 4-ARRIB ][ 5-ARRIB ] [ 3 ][ 1-ABAJO ][ 2-ABAJO ][ 3-ABAJO ][ 4-ABAJO ][ 5-ABAJO ] ....
Por ultimo si hacemos:
# insmod arcade.ko map=0,1,1,1,1,3
Facilmente podemos conseguir 4 joys de 8 botoncitos y una configuracion basica de teclado 
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-ARRIB ][ 2-ARRIB ][ 3-ARRIB ][ 4-ARRIB ][ 1-EXTR1 ] [ 3 ][ 1-ABAJO ][ 2-ABAJO ][ 3-ABAJO ][ 4-ABAJO ][ 1-EXTR2 ] ....
Lo primero Necesito testers linuxeros!! xD
El principio el proyecto solo es para Linux, pero si alguien quiere hacer un version Windows o MSDOS, no me importaria ayudarle siempre que el proyecto siguiera siendo abierto 
Dejo como curiosidad el primer interface que prepare para ir probando el OpenPPjoy xDD

(Sorry for my english
)
Make an opensource driver that use LPT for our controls. I will work on Linux, but the driver is open, if someone wants port this driver to MSDOS or Windows, it is free to made it 
The initial objetive is to make a software keycoder (push a button goes to sim a push some key) and support to basic virtual joysticks ( 8 buttons and 2 axes).
At the moment the driver is not configurable, but it is full working if you create a panel for him... this panel would be compatible with PPjoy closed code version (see configuration modes in his documentation).
There are some info that you need read:
- Marcianitos LPT tutorial (spanish)
http://www.marcianitos.org/tutoriales/IC018.htm (archive.org)
- The discussion topic about OpenPPJoy (Spanish too):
http://www.forumcommunity.net/?t=2173834
(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IRE8 ][ 2-FIRE8 ][ ][ ][ ]
In this way the driver only have to look the number of active columns/controls and not to have wait more of the necessary. If you have read the previous links, you will see that the implementation of this driver on arcade control panels is very simple. Here some examples:
NOTE: This diagram need an update.
#JOY1
|--@---(2)
|--@---(3)
|--@---(4)
|--@---(5)
L10-[ diode ]---------------------|--@---(6)
|--@---(7)
|--@---(8)
|--@---(9)
|--@---(1)
|--@---(14)
|--@---(16)
|--@---(17)
Legend: @ - Buttons, configured on: "normally closed".
(n) - Data lines.
lnn - Read lines.
And you could add more joysticks with the next available lines (11,12,13,15). If you dont see yet, you need get attention to the next example with two controls:
NOTE: This diagram need an update.
#JOY1
|--@---(2)
|--@---(3)
|--@---(4)
|--@---(5)
L10-[ diode ]---------------------|--@---(6)
|--@---(7)
|--@---(8)
|--@---(9)
|--@---(1)
|--@---(14)
|--@---(16)
|--@---(17)
#JOY2
|--@---(2)
|--@---(3)
|--@---(4)
|--@---(5)
L11-[ diode ]---------------------|--@---(6)
|--@---(7)
|--@---(8)
|--@---(9)
|--@---(1)
|--@---(14)
|--@---(16)
|--@---(17)
Legend: @ - Buttons, configured on: "normally closed".
(n) - Data lines.
lnn - Read lines.
Finally you can use 5 controls with 8 buttons each or 3 controls and 2 basic configurations of keyboard, etc... it is your choice! 
(1) JOYSTICK: 2 axes y 8 buttons.
KEYBOARD:
(2) KEY1 - CURSOR_UP
CURSOR_DOWN
CURSOR_LEFT
CURSOR_RIGHT
CURSOR_SPACE
LEFT_CONTROL
LEFT_SHIFT
LEFT_ALT
ESC
ENTER
[5]
[1]
(3) KEY2 - [W]
[S]
[A]
[D]
[Q]
[E]
[Z]
[X]
[C]
[V]
[6]
[2]
To a complete install the driver you need the Linux kernel headers in ubuntu will be:
# apt-get install linux-headers-`uname -r`
When instalation is complete, do it:
# make
If the source is compiled ok, now you need configure it. You can use "map=" to adapt the driver to your hardware, the module parameters are:
map=x,y1,y2,y3,y4,y5
The [x] defines the paralel port to use, in most cases will be 0.
The [yN] defines the number of the control type that you want to use from this list:
1 - 8 Buttons Joystick
2 - Key config 1 (see above)
3 - Key config 2 (see above)
Some final examples, but note that "insmod" loads the module, and "arcade.ko" it is the module (if you dont understood, please search tutorials about modules, kernel... on internet).
# insmod arcade.ko map=0,1
And this loads a joystick with 8 buttons on line 10...
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-UP ][ ][ ][ ][ ] [ 3 ][ 1-DOWN ][ ][ ][ ][ ] ....
But if you type:
# insmod arcade.ko map=0,1,1,1,1,1
Would have 5 joysticks of 8 buttons thats is reading the lines: 10,11,12,13,15 
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-UP ][ 2-UP ][ 3-UP ][ 4-UP ][ 5-UP ] [ 3 ][ 1-DOWN ][ 2-DOWN ][ 3-DOWN ][ 4-DOWN ][ 5-DOWN ] ....
And finally:
# insmod arcade.ko map=0,1,1,1,1,3
We can easily get 4 joysticks with 8 buttons and a basic configuration of keyboard 
[ ][ 10 ][ 11 ][ 12 ][ 13 ][ 15 ] [ 2 ][ 1-UP ][ 2-UP ][ 3-UP ][ 4-UP ][ 1-EXTR1 ] [ 3 ][ 1-DOWN ][ 2-DOWN ][ 3-DOWN ][ 4-DOWN ][ 1-EXTR2 ] ....
This is the first interface to try OpenPPjoy driver testings 

WORK IN PROGRESS
Release publicas del proyecto:
Subido: viernes, 14 de julio de 2006 a las 11:22 [Descargas: 883]
Driver Compatibility:
Ubuntu Breezy (Kernel - 2.6.12)
Dapper Drake (Kernel - 2.6.15)
Version Estable:
No añadire mucho mas al driver de linux, en principio es lo que necesito, pero si alguien tiene alguna sugerencia o quiere aportar algo al codigo es libre de hacerlo... eso si, agradeceria que nos enviara los cambios para hacerlos publicos y que todos podamos disfrutarlos!
Stable Version:
At the moment the code is feature freeze, but the driver is open source... If you want, you can do your changes, updates and send me your patches! Enjoy the driver!! 