Joystick port as GPI

From Rivendell Wiki

Jump to: navigation, search

Q: I only need three GPI closures, is there a tutorial on using a standard serial somewhere?

A: Not a serial, but if you've got an old SoundBlaster card around with a 15 pin joystick port, that'll get you four GPIs. See GPIO.txt for the details.

Q: I did have a old SB card around and have it installed as per GPIO.txt 47k resistors on the axis controls and all.

Problem is if I run a joystick test in yast everything works it shows all axis at 50 and all buttons work. If I run

jstest /dev/js0 

from the command line everything works. If I run

jstest /dev/input/js0 

from the command line everything works.

however after setting /dev/js0 or /dev/input/js0 up as a local gpio in rivendell with 4 inputs I get nothing.

RDGpiMon shows the four inputs but no indication on closures.

Response 1: Is rduser allowed to access that device? Also the device must be created before the daemons start.....

Response 2: You may have the wrong device name entered for your joystick port in the 'Device' field in your Local GPIO switcher description in rdadmin > Manage Hosts > 'hostname' > edit > Switchers GPIO > Add > Local GPIO ...

You obviously have your soundcard / joystick port / joystick port connector, (with it's pull-up resistors fitted) all working correctly.

Try this to determine the device name, (openSuSE 10.2 / rd1.5.0)

Power down the host and disconnect your adapter plug from the joystick port on your soundcard.

Power up the host and then look in /dev/input and note what is listed there ... ( on the host beside me I get /by-path, -event0, -event1, -event2, -mice, -mouse0 ).

Power down the host and reconnect the joystick port adapter plug then power up again and have another look in /dev/input ... (I now get /by-path, -event0, -event1, -event2, -event3, -js0, -mice, -mouse0 ).

Note the appearance of -event3 and -js0

In the 'Device' field for your Local GPIO switcher description try using /dev/input/event3 ... set the number of GPI's and what action each one should take etc and see if the joystick GPI's now work.

On the host beside me I am using /dev/input/event3 and have only 2 GPI's set, (we only use 2 inputs via the joystick port) ... one input fires a macro cart to stop the log while the other fires a macro cart to start the log.

A: Well the user has permission for that group which appears to be game. I have tried to as su cat /dev/input/event1 2 3 4 5 6 7 8 9 and see nothing however cat /dev/js0 or cat /dev/input/js0 show activity on closures, but either of those devices placed in local gpio config don't work when using rdgpimon. Thanks for all the help and suggestions, I got it working. Even thought yast saw the joystick port and all tested well fot some reason Rivendell didn't until I deleted the SB audio card and reinstalled it.

Followup: After all the experimenting and problems I had with the Sound Blaster card in my previous posts of "GPI Hell" and "audio pops and clicks" I have solved my problem very cheaply so I thought I would share.

I purchased a $19 usb joystick, dismantled it and retrieved the 1.5 inch by 2 inch circuit board from inside and now have 11 gpi inputs.

Rivendell saw the interface as /dev/input/event6 on my box and all works well. Doesn't do anything of course for outputs, but if all you need is inputs, what a cheap solution. Spent a couple of extra bucks on a little bud box to mount the board. :) The board contains a uart with a bcd input so if you wanted to extend the matrix you could go way beyond 11 GPIs. -- Tim Camp

Personal tools