Notices


Reply
Thread Tools
Posts: 2 | Thanked: 0 times | Joined on Sep 2008
#1
Hi,

i just found some time to hack a simple gamepad "driver" so USB gamepads work with vgb. you can see a demo here

http://www.youtube.com/watch?v=j5bm2jMmKGQ

what does it do?
i couldn't find any information wheter there's a possibility to use an usb gamepad with the joystick modul with vgb/vgba. There's no config files etc. so i just did the obvious: i wrote a simple little prog that polls a device node ( e.g. /dev/input/event4 ) via ioctl and read, maps the input values to keys and sends them to any application that has the focus via XTestFakeKeySend. it's a dirty hack really, the code quality reflects that. currently it's tailored towards my logitech precision gamepad and vgb. the axis are mapped to left,right,up, down and the first buttons are mapped to the keys j,m

how to use it
redirect your browser to http://apiservers.com/hosted/marzec/dev/usbgp/. there you can find usbgp.c as well as the binary for os2008. you will also need a usb gamepad and an adapter to be able to connect it to your it. you have to enable host mode for the usb hub. to do so install usbcontrol and turn host mode on. plug your gamepad and check the directory /dev/input. you'll find a couple of eventX files there. the one with the highest number is probably your gamepad. call usbgp with the filename of that device node and you should be ready to go.

limitations
as i said, it is handtailored toward my gamepad. one probably has to adopt the button codes to his own gamepad. this is really not a release but more a base for people who want to make this a nice package. you'll probably even better off rewritting the thing from the ground using this as a reference as the code was written with nano directly on the device and suffered a lot therefor. i also shamelessly copied some code from http://www.frogmouth.net/hid-doco/linux-hid.html, just in case you find some code familiar.

i'm not a linux pro and this was my first attempt doing something like this. if i get to know how to build debs and find some more time i'll write a small gui so you can configure all this stuff easily for any gamepad.
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#2
Haven't looked at your code, but it sounds like evrouter would handle everything you're doing.

It's a straight-up build on the tablets.
 
Posts: 2 | Thanked: 0 times | Joined on Sep 2008
#3
yes,evrouter sounds like a perfect generic solution. thanks for the tip. hacking it myself was a lot more fun though
 
Posts: 100 | Thanked: 38 times | Joined on Apr 2008
#4
Originally Posted by Benson View Post
Haven't looked at your code, but it sounds like evrouter would handle everything you're doing.

It's a straight-up build on the tablets.
I know you say its a "Straight-up build" which sounds simple .... I'm a total newb with linux stuff. I've done a little coding, but what would I have to do to get this to work?

Thanks.
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#5
Well, what I did was to add the SDK repository (not intended for tablet consumption, and including some packages which will rip out half (specifically, the more important half) of your system), apt-get install gcc (installs the compiler), a few more apt-get installs to get development packages, then just the usual
Code:
./configure
make
And out popped a nice binary, ready to roll.

(FWIW, the repo and apt-get install are pretty much Maemo-specific; the last two lines are all that's specific to this program, and indeed are pretty simple. Getting set up for on-device development, OTOH, isn't quite simple, though it's not that hard either...)

Since you probably don't feel comfortable getting a build environment set up, you can download it. Search these forums for evrouter; I posted it as an attachment somewhere in the USB mouse support thread.
 

The Following User Says Thank You to Benson For This Useful Post:
Posts: 308 | Thanked: 62 times | Joined on Jun 2009 @ Turkiye
#6
 
Special.Guest's Avatar
Posts: 6 | Thanked: 0 times | Joined on Oct 2009 @ Chile
#7
This is fantastic ... !

but how do I make this happen ?!

marzec's link is dead and I can't find a working version of evrouter nor do I know how to set it up with a gamepad ...

this would be a major improvement to my old snes games

any help would be most welcome
 
Posts: 345 | Thanked: 100 times | Joined on Nov 2009
#8
If we can do it with the N900 it will be awesome.
 
javispedro's Avatar
Posts: 2,355 | Thanked: 5,249 times | Joined on Jan 2009 @ Barcelona
#9
No, the N900 does not have usb host.
 
Posts: 345 | Thanked: 100 times | Joined on Nov 2009
#10
In maemo Nokia page I can see the micro-USB connector in the specification of the N900:
http://maemo.nokia.com/n900/specifications/
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:13.