maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Games (https://talk.maemo.org/forumdisplay.php?f=12)
-   -   USB Gamepad + VGB (https://talk.maemo.org/showthread.php?t=23629)

marzec 2008-09-15 14:19

USB Gamepad + VGB
 
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 2008-09-15 15:52

Re: USB Gamepad + VGB
 
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.

marzec 2008-09-15 16:17

Re: USB Gamepad + VGB
 
yes,evrouter sounds like a perfect generic solution. thanks for the tip. hacking it myself was a lot more fun though :)

Cruelkix 2008-10-01 02:58

Re: USB Gamepad + VGB
 
Quote:

Originally Posted by Benson (Post 224077)
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 2008-10-01 03:08

Re: USB Gamepad + VGB
 
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. :)

McLightning 2009-07-21 13:16

Re: USB Gamepad + VGB
 
http://apiservers.com/hosted/marzec/dev/usbgp/
link is broken

Special.Guest 2009-11-30 19:27

Re: USB Gamepad + VGB
 
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 :D

any help would be most welcome

soleil 2009-11-30 21:47

Re: USB Gamepad + VGB
 
If we can do it with the N900 it will be awesome.

javispedro 2009-11-30 21:55

Re: USB Gamepad + VGB
 
No, the N900 does not have usb host.

soleil 2009-11-30 23:22

Re: USB Gamepad + VGB
 
In maemo Nokia page I can see the micro-USB connector in the specification of the N900:
http://maemo.nokia.com/n900/specifications/


All times are GMT. The time now is 16:27.

vBulletin® Version 3.8.8