MHeironimus / ArduinoJoystickLibrary

An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Button Indices for Android Gamepad.

PsykomantaBrain opened this issue · comments

Not so much a feature request as much as a general discussion (sorry if there's a better place for this).

I built a new device this week, or rather, resurrected an old drone controller that was incompatible with everything by giving it new brains in the form of an Arduino Due and the MH Joystick Lib. Set it up as an 8 axis, 8 button device (that's how many the drone controller had).

The device is working ok in windows already as a DirectInput device. But I also want to use it as a gamepad for mobile devices, as the drone controller features a mount for phones and tablets already.

On Android, it was easy enough to get the board recognized as a gamepad using an OTG usb connector. I then used that to calibrate the outputs and order my axes to make the most sense as what android expects of a gamepad layout.

The trouble I'm having now are the buttons. I'd have thought that button 0 would map to gamepad A, 1 to B, and so on, but I'm not getting much luck in getting any button presses detected.

Has anyone ever tried this, and know if there's some special shenanigans that need to be done for buttons to be read as gamepad buttons in Android?

In windows, the same 8 buttons are reporting normally in joy.cpl, no issues.

Thanks in advance for any... (puts on sunglasses) input.

Cheers