Android and Guitar Hero controller
Asked Answered
H

3

11

I know that the latest versions of Android (Honeycomb and ICS) have support for joysticks and gamepads. Guitar Hero (and Garage Band) controllers are essentially USB HID devices, right?

So my question: Is that possible to receive data (button clicks) from the Guitar Hero (or Rock Band) controllers on Android device? Would the Android understand it as a gamepad input?

P.S. all I need is to detect in my game the input from those five buttons on the plastic guitar fret.

Hardily answered 23/2, 2012 at 6:12 Comment(1)
One alternative would be hacking the guitarr, letting a Arduino act as the middleman between the Android and the guitarr.Kerekes
C
6

A good starting point would be to review the linux source code for Frets On Fire, which supports some of the Guitar Hero controllers.

Frets on Fire: SourceForge

SVN: https://fretsonfire.svn.sourceforge.net/svnroot/fretsonfire

It looks like it would be difficult to universally support all controllers, from different platforms. Each console has it's own protocol, but it does look like JoyStick to keyboard emulation is possible on the PC with the PS3 controller. There is a config file for the PS3 controller on the second link that may be helpful, it's for JoyToKey (which isn't open source), but some of the values in the config may help you.

Crelin answered 25/2, 2012 at 18:22 Comment(0)
R
4

Hey this is a really cool idea. start here:

http://developer.android.com/guide/topics/usb/host.html

Then, check out this sample:

http://developer.android.com/resources/samples/USB/MissileLauncher/index.html

in that sample, there is a method named setDevice(UsbDevice device)

If I were implementing this, I would start with a duplicate of the MissileLauncher project, and modify this setDevice method. I would log everything I could possible find about the UsbDevice device and try experimenting with these conditionals in the setDevice method:

if (ep.getType() != UsbConstants.USB_ENDPOINT_XFER_INT) {
...
if (intf.getEndpointCount() != 1) {

While the MissileLauncher uses this type and this endpointCount, it is very likely the garageband controller will have different values

ALSO

check out the run method to see an example of back and forth communication

DISCLAIMER: I have no idea if this will work. I've also seen blogs stating this cannot be done.

Rorqual answered 1/3, 2012 at 5:21 Comment(0)
M
0

My guess is it should detect data. This is even possible on existing Android devices - but it is not Android Market friendly.

To accomplish this on non-4.0 devices you must provide an alternative power source to the usb port. Usually this can be done with a cheap usb hub that leaks power. The device also must be rooted. Once this is complete you need to create an interface to the device shell to launch a native language like C outside of your Dalvik VM. Use your C to bind to the appropriate socket and you should be able to bus data back and forth. You may also need to compile a kernel module to give driver support.

Like I said this is a complete hack for device below 4.0. But it is possible.

Manage answered 2/3, 2012 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.