Sega Genesis 6-button Joystick with DirectPad Pro interface.
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sega Genesis 6-button Joystick with DirectPad Pro interface.
Hello!
I'm trying to connect 6-button joystick from Sega Mega Drive on Slackware 11 linux/2.6.17.13 kernel. Joystick is connected to parallel port usin this scheme, taken from here. The problem is that while there is a native support for this kind of joystick, db9 module in linux kernel needs a different interface - this one. As a result, I can easily insert module into kernel, but joystick won' work.
I did not find any info about supporting DirectPad in kernel sources.
It could be easy to hack db9.c and modify certain bits sent to parallel port, but it looks like DirectPad needs to write into "data" pins and I didn't yet find out how can I do it. (standard interface reads from data pins and writes at least to strobe pin, and it looks like writing into "data" pins requires some other technique)
So, the question is:
Is there a patch/driver that provides support for such interface in 2.6.17.13 kernel without rebuilding joystic interface using soldering iron?
I've been looking for an answer for some time now too, haven't found yet. Not that I would have spent endless hours for that, but still. I'm interested in the solution too, hope you'll find an answer if I don't.
I've tried to modify drivers/input/joystic/db9.c file to figure out correct values to pass into parallel port, but it looks like to use DirectPad Pro interface I need another method for writing data into serial port - I've tried to modify DB9_NORMAL and DB9_NOSELECT values to make them trigger joystick input pin used for synchronization. I've tried setting DB9_NORMAL to 0xFF and DB9_NOSELECT to 0xF0 and 0x0F - because DirectPad Pro interface has 6 serial port pins connected to +5v pin, one of the values was supposed to trigger select line while keeping joystic's power supply alive. since there is only 8 bits to read pressing buttons on joystic should have triggered some buttons which db9 understands. Unfortunately, this didn't work, nothing happened, and pressing any button didn't trigger anything in both casses. It looks like I need another technique to write into parallel port.
This joystick was working with this interface WindowsXP using PPJoy driver, so there should be no problems with the joystic or interface.
---
I've found linux-joystick mailing list, and sent same questions there.
Quote:
Originally Posted by b0uncer
I've been looking for an answer for some time now too, haven't found yet. Not that I would have spent endless hours for that, but still. I'm interested in the solution too, hope you'll find an answer if I don't.
Ok. As a last resort I can always try to rebuild an interface...
1st, try not to re-build the interface. The very worst you should have to do is make an adapter. I think is was Radio Shack that used to sell a DIY kit. It a male/female pair of DB25's connected by a really simple blank circuit board. It came w/ a bunch of short, solderable jumper wires & then went into a black case. The whole thing was maybe 2.5 x 1.5 x .6 inches. I think it looked something like this, as best as I do ASCII art:
The idea was to be able to connect any pin to any other pin(s) w/ complete flexibility. I used one to make a "Laplink cable" conversion adapter. A sort of parallel null modem cable.
BTW, I doubt that RS stills sells these, & I have no idea who might.
Laplink & its competitors were able to do the kind of writing to the parallel port that you want to do.
1st, try not to re-build the interface. The very worst you should have to do is make an adapter.
Well, I have some trouble with english names for electronic parts, but I hope you'll understand.
Current "interface" is really an adapter, that i've made mysefl - it is just two connectors (or is it called "socket"?) - one for sega Genesis and one for parallel port, connected with wires and several diodes - so I'm able to unplug joystick from this "adapter". The whole thing is small enough and could have been placed inside the cases of those connectors, if I had more patience. I could have made another adapter like this one but this is painful - I had real trouble with soldering wires with those small pins (?) on the back side of connectors, and I'm not in the mood to go through that again. So I just want to remake driver for this thing - because I'm better programmer than repairman or whatever.
Quote:
Originally Posted by archtoad6
I think is was Radio Shack that used to sell a DIY kit. It a male/female pair of DB25's connected by a really simple blank circuit board.
nice Idea, but I've never seen something like this in the shops in my town.
Quote:
Originally Posted by archtoad6
Laplink & its competitors were able to do the kind of writing to the parallel port that you want to do.
From the 2nd:
This probably means that there are Linux drivers somewhere that you can either use or modify.
Hmm. Thanks, I'll check this.
Quote:
Originally Posted by archtoad6
Or I have completely misunderstood your problem.
No, everything is fine. I just don't know how to write into certain pins because I don't have a sample code.I remember that there were two modes of operation for parallel port, and one of them was more advanced (and allowed to write into the pins I want to use). It looks like db9.c uses "simple" mode and I need "advanced" one...
Here I am, just dropped to admire my own art, & I noticed you never posted any results.
How about it -- How did it go? What happened?
Well, I'm ashamed to say, but I've managed somehow to never start fixing the problem until I've recieved notification about your post today. :-\
After that I've finally sat down and was able to create a draft version version of fixed db9.c with dpadpro interface (file is attached to message). That took just 30 minutes. Well, it just proves that "never plan to do tomorrow something you can do right now".
Right now joystick responds (in control center in KDE), but all controls are messed up (so it is unusable, but you at least can see it 'kind of' works). to use new interface you'll need to insmod db9.ko with parameters dev=0,13 .
You can either fix constants used in new db9.c yourself, or you can wait until I'll do it. Since right now i'm really angry about how much time I've spent planning to "fix that thing later", I'll most likely fix it pretty soon. (certainly it won't take another six months!).
the db9.c is taken from 2.5.21.5-smp kernel source for slackware 12.
The situation is following:
joystick correctly reacts to pressing "left" and "right", it also reacts to "b" and "c" buttons. However, it ignores anything else, and pressing "b" also presses "a", while pressing "c" also presses "y". (I'm using KDE control center "peripherals->joystick" section to check it).
Also, I either don't know how to read data from Autofeed and Strobe buttons, or joystick is fried.
Reading/writing to data pins is very straighforward - it is done through parport_read_data or parport_write_data, however reading using parport_read_status gives number that doesn't change (see comments in the piece of code abouve). So it looks like either joystick is dead, or I'm doing something wrong way.
I'll check joystick, and write write back after that.
It looks liks it isn't possible to connect Sega Genesis joystick with DirectPadPro interface using current version of "parporot" kernel module and by hacking db9.c. At least, I don't know about such way.
Reason:
db9.ko uses parport.ko to access parallel port.
For parport.ko, there are three kind of pins:
data (data0-data8), status(error, select, paperout, ack, busy) , and control(strobe, autofeed, init, select).
"status" pins are read-only, "control" and "data" pins are read/write (using functions like parport_read_data, parport_write_data, etc.), but there is a little trouble:
what "parport_read_control" returns is really last written value (at least, documentation says so). I.e. I can't read control pins using parport module, although it might be possible with real hardware and maybe another kernel parport module I don't know about. (Also, It looks like some more specialized modules allow to read control pins state, but I'm not sure if this is what I need -i.e. this might be actually last-written value :-\)
Unfortunately, DirectPadPro interface uses strobe and autofeed control lines to receive state of Up and Down buttons, which are also used as "X" and "Z". So it won't work.
As for button "A" being pressed together with "B" and "Y"(it was a misprint before, pressing "С" also presses "start", not "Y") being pressed together with "C", it looks like there is some programming bug (my own, of course) and state of the status pins isn't being reread after sending control pulses to joystick.
So, to make it short.
Even if I'll fix "sticky buttons" bug, it won't be possible to use Up, Down, X and Z buttons - the just won't work. This is because I don't know how to read the state of Autofeed (signal that joystick sends to that pin, I don't need last-written value) and Strobe pins. If there is a way to do this, then it's possible to use DPadPro interface.
Also there might be another module for parallel port, that supports reading from those control pins. although in this case I'll have to write a full driver for joystick and won't be able to hack existing db9.ko.
So I suppose it's better to rebuild the DirectPadPro interface into Linux interface, or it is possible to make custom interface (that doesn't send signals to unusual pins) and create a custom version of db9.ko for it (this is easy. Well, relatively easy).
Also, it might be possible to change behaviour of parport, but it looks like it is a kind of wrapper around of bunch of other specialized parport drivers (although I'm not really sure about that), so I think messing with this behaviour isn't good idea.
I believe that's all. So, next time I'll need Sega MegaDrive joystick, I'll rebuild interface with soldering iron.
2archtoad6
Thanks for writing that last comment. If I didn't receive notification about it, I'd probably never looked into this problem after all (It's just too much happened during that time and I've almost forgot about that joystick driver). Hacking kernel driver and digging parport information was quite interesting, even if it didn't solve problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.