Rummys Blog An world of endless Monday

Saturday, 29 June, 2013

Android USB gamepad transmitter

Filed under: — Andrew.Rowbottom @ 10:40 am

I’ve managed to get vJoy (sourceforge version) working with kainy by mapping the gamepad buttons up to keystrokes and then using AutoHotkey to capture those keys and send them onto the relevant vJoy gamepad buttons. Quite a faff, neuropathist and only works with FFXIV because there are a load of keybinds that are close or even equivalent to the gamepad buttons… so I don’t have a problem with buggering up keypresses particularly.


My idea is to create a background program … service? … on android that will read the USB and send the appropriate button presses to a simple service on Windows that will then in turn call vJoy.. very similar to the existing system, pfizer but without needing Kainy.

I dont believe I’ll be able to capture properly formatted Gamepad input events without having something “sit” on the screen, possibly as a transparent overlay.. all sounds quite complicated, and probably forbidden since it would be able to basically act as a keylogger!
Its for this reason I’ll be grabbing the USB directly.

Since its easier to develop in Windows I’ll be making the Android side very light… and just send UDP packets to windows with the USB contents. Then in windows I’ll convert the raw(ish) USB to vJoy calls.

Thing is I’ve never developed anything for the android, so it’s going to be a little tough figuring out all the API’s.

Some possibly useful links:

Android 3.1 USB-Host – BroadcastReceiver does not receive USB_DEVICE_ATTACHED stackoverflow

USB_DEVICE_ATTACHED Intent not firing – stackoverflow (HID device issue?)

Source code to crib:

The USB/IP Project – last update 06-2011, seems to come with a signed windows driver, may be too raw!
USB-serial-for-android (

USB Monitor (accessory samples) – doesn’t actually communicate much, but *is* a very light “initial” framework

Android USB Host Tutorial – example sending/receiving using USB and the ADB protocol (sending/receiving raw packets)

Basic4Android – disgusting, I know, but may be a launchpad

MissileLauncher example – expecting this to be the same as the sample

Android-USB-Serial-Monitor-Lite – github

USB-Device-Info—Android – github

DetectUSBDevice – sample code – github, possibly a little more than wanted 🙂

android-background-service-usb-accessory – github, may be very useful as a skeleton. Not sure about accessory mode though.


DroidMote – may be able to hijack the server .. more code on android, less in windows, and may bypass the vJoy step.


agamepad uses PPJoy, and the standard input devices.. github, so source code available (and server)


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress