Making Beagleboard-xm appear as a joystick to pc host

I am working with some researchers in developing a game controller for people with disabilities of the hand. The idea is to explore different techniques for capturing gestures and converting them into joystick axis movement and button pushes.

I was wondering if anyone has an example of how to make a BeagleBoard-xm (or a BeagleBone Black) appear as a joystick to a host pc.

Any help would be appreciated.

I would like to use Debian.

-David Glaser

Searching the internet, you’re likely going to find people who say this is not possible. At least where USB is concerned. Where the RasberryPI is concerned the USB ports on it are connected to a hub chip, which then runs in USB master mode. So . . . using HID USB descriptors is not possible in this case. Or so I’ve read.

However, with all that said, I do believe the beaglebone’s ‘client’ port is capable of USB slave mode. Regardless read Phil Polstra’s post here: https://groups.google.com/forum/#!msg/beagleboard/Umoa2yElKM8/JdD0SY_oCQAJ

He did a DEFCON demonstration using a beaglebone to emulate a PC keyboard( I think ). That should be more than enough to get you started.

Additionally, the beaglebone does have at least one USB port that can run USB gadget devices on it, g_ether comes to mind( USB network interface ). Or you could just use the ethernet port. Or(again ! ) you could use a USB to UART cable. Such as the serial debug cable( and tty device on the beagelbone ).

Then the idea becomes writing client / server app(s) for which the sky is the limit.

Ug, I keep thinking of stuff after I post, heh.

SO as an experiment there would be nothing wrong with using a beaglebone, or beagleboard for this purpose. However, if you’re unfamiliar with Linux, and writing code for such. It could be beneficial to just start off with something else. Such as a USB capable PIC32, or any number of Cortex M0/M0+, M3/M4 dev boards on the market.

I think TI even has a recent board based on their TM4C(Cortex M4 ) processors that is meant to be a USB dev board.

But the point is, if you’re going to start off knowing nothing of what you need to learn, etc. You may as well start off with a “bare metal” type device. Cost, and complexity wise you’re life will be a lot simpler. With the trade-off that you’ll have to get your hands dirty writing low level code( at the register level ).

William, thanks for the replies.

It turns out that there are some more requirements that I did not state.

  1. The joystick needs to be xbox360 compatible. The reason for this is that most pc games out there support the xbox360 controller.
  2. The xbox360 controller has a lot of behavior that will be tedious and time consuming to emulate. So we would like to develop a “box-in-the-middle” that would pass usb traffic between the pc host and the xbox360 controller without modification but allow us to inject our own traffic from the box-in-the-middle to the pc host. The bb-xm seems to fit the hardware requirements since it has a USB OTG interface and a USB Host interface.
  3. The box-in-the-middle needs to be able to interface to analog/digital inputs; but also interface to external systems via serial interface or tcp/ip connections.
  4. We tried to use an arduino based approach but found that software development to be very difficult due to the lack of debugging capabilities and poor software development environments. We found that a good development/debugging environment for “arduino platform” requires a cross system development setup. This is inherent in a linux environment where the host and target are the same system. Gotta luv GDB.
  5. Right now I’m digging through the xboxdrv software with the intent of using it on the bb-xm to deal with the box-in-the-middle to xbox360 controller traffic. It is a user-mode driver and I’m having a lot of fun digging through the C++ code. Pretty amazing what one can do with udev, uinput, and libusb.
  6. The unknown part that I’m dealing with is how to set up the gadget_fs on the otg port to emulate a joystick so I can send the usb traffic to the pc host.
  7. Yes I’m a newbie to usb programming but I am and old codger that used to write operating systems in my dim past (late 1970s and early 1980s) with a lot of time on his idle hands. I just need to see examples and from there I can figure out the rest.

-David

David,

Have you looked into the Linux Gadget system? Here's a talk from the
Embedded Linux Conference that demonstrates setting up a usb gadget on
linux:

https://www.youtube.com/watch?v=JLhcE0O4bt0

Ted Roth

For a USB HID, according to what I’ve read. You do not need to worry about all that. You just need to write or have an HID descriptor file.