USB HID controller?

I saw ArduController - USB Keypad with programmable profiles and it occurred to me that the Arduboy might make an interesting USB controller for games on an Android phone.

The github project provides links to various keycodes, but I didn’t see anything that looked like they would be right for that use.

Anyone know if this will work? If so, what would the profile look like.

Hi. I tried to make it map to xinput, but you need to pay m$ a fee to have your hardware “certified”, so you’re stuck with just a keyboard.

I’m working on adding mouse controls, then you’ll be able to write profiles that touch parts of the screen on android.

But right now, you can just plug it in, at least the emulators I use support mapping keys.

Why would I have to pay MS for a certification to connect to an Android phone? Maybe if I wanted to connect to an MS system of some sort, but Android?

The included HID libraries on Arduino won’t simply work if you plug in an OTG cable?

Xinput is a standard for controllers. M$ controlls that standard. If you want to make an Xinput device, you need to pay M$. Even on other devices that implement that standard.

They HID libraries do work @bateske . I tested it with my phone. Only problem is my program doesn’t support mouse movement yet, so interacting with touchscreen apps is an issue.

So, the Xinput profile is needed to do keyboard+mouse… on Xbox right is what you are saying? Or PC too?

Xinput is a standard for controllers. Xinput is a completely separate thing from keyboard+mouse.

Most games use xinput, and because xinput is standardized you don’t need a keymap for each game.

1 Like

It was originally developed as a replacement for Microsoft’s DirectInput and was used for both Windows and Xbox 360.
(Microsoft went through a phase of making Windows and Xbox very compatible, see XNA and its evolved open-source form Monogame (long story).)
That compatibility is what sparked Xbox controllers being used for Windows games so much.
Naturally people then wanted to port it to other operating systems so it became an ‘open for a fee’ standard, and more controllers got made because there was suddenly a market for them.

*End of semi-factual abridged history of XInput*

(The API is basically completely geared towards Xbox controllers, it supports 4 axes, 10 buttons and 2 triggers to match Xbox exactly. It isn’t intented for mice and keyboards, but it’s possible to make a keyboard/mouse pretend to be an XInput device. It’s more difficult to make an XInput device pretend to be a mouse/keyboard though, not impossible, but somewhat difficult.)

That was a great explanation, thanks!

Yeah, what I was trying to say is ideally you’d want to emulate an Xinput controller for maximum compatibility, but you can’t without paying a “certification” fee.

1 Like

Not only does it work, but there’s already a program written for it: Virtual Gamepad (no keyboard/mouse hid)

1 Like

Oh, awesome! I didn’t know that library existed!

I’m gonna add that library as an option for ArduController, because I still want customizable profiles :smiley:

Edit: Spent some time playing around with that, and at least on Arch Linux with xpad it doesn’t seem to work properly :confused:

1 Like

Out of interest I tested it on my Windows computer and it seemed to work fine (after a bit of fiddling and updating to the latest Joystick library), so it’s probably a Linux-specific bug.

Did you use the hex file or did you compile the source?
And did you use the latest version of the Joystick library?

They’re currently on version 2.0.3 and @eried linked to 1.0.1, a lot has changed and it looks like the newer version is more efficient and has more features (and still compiles correctly), so they might have fixed some Linux-specific bugs.

Just a thought.

Yeah, the only controller I’ve gotten to work flawlessly on my box is the Steam controller, so it’s definitely Linux specific.

I compiled it myself, using 2.0.3.

If you’ve had issues with other controllers then it probably is xpad’s fault.

I’d say raise an issue but it looks like they’ve already got quite a lot of those, so it would probably be a while until it was fixed depending on the exact issues.

I’m not surprised the Steam controller worked well, Valve have been very Linux-conscious in recent years. (Plus it had to work with ‘Steam Machines’, which are Linux based.)