Find the answer to your Linux question:
Results 1 to 3 of 3
Most people want to plug a joystick into their computer. Instead, I'm trying to make my linux box look like a HID joystick when I plug it into another computer. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2009
    Posts
    1

    Make Linux Emulate a Joystick


    Most people want to plug a joystick into their computer. Instead, I'm trying to make my linux box look like a HID joystick when I plug it into another computer. Basically I want some C code running in linux to be able to output joystick commands through the USB HID interface into another computer. Any ideas on how to do this? My one thought so far is to use a HID input device like the "Joystick Emulator, USB keyboard" product from microcontrollershop dot com (sorry, it won't let me post URLs).

    This means I need to use a DAC to generate an analog signal, but I would want one that is very simple and cheap since most of them are built to drive audio systems.

    Any other approaches? Any recommended DACs for this application?

  2. #2
    Linux Newbie tetsujin's Avatar
    Join Date
    Oct 2008
    Posts
    117
    Quote Originally Posted by joshjohnston View Post
    Most people want to plug a joystick into their computer. Instead, I'm trying to make my linux box look like a HID joystick when I plug it into another computer.
    A basic problem here is that USB isn't really made for connecting two hosts - rather for connecting one host to a number of slave devices. The kernel does contain support for acting as a USB slave device if you've got the hardware for it. (This is used, for instance, on Linux-based handhelds which need to sync with a PC via USB...)

    I have built a USB gamepad using a PIC microcontroller as the core... Something like that would probably be the easiest way to cook up a USB device you can control: for instance you could create a device with two such PICs, acting as two USB devices (one for the Linux host, and one for whatever device you want to have the "joystick") and then make the two PICs talk to each other, ferrying instructions from the Linux host to the game system. (You could even reduce that to a single PIC by communicating to the Linux host using an RS-232 connection, possibly over a USB-serial bridge...)

    Another approach would be to take a self-contained USB joystick circuit and feed data to it externally... This would simplify things somewhat as you wouldn't need to create a USB device yourself - but it sounds like you want the joystick data to be analog, which I guess would explain why you're looking for a DAC... That being the case I would just skip the DAC and build a USB joystick circuit that takes digital commands from the Linux host.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,748
    Sorry. Can't help you. I've done just the opposite - made an analog joystick emulate a mouse for X-Windows. In any case, you might be able to do this, but you need full documentation of the protocol / USB messages that are required for this at the very least. In fact, I would try to do it without any D2A conversion hardware if at all possible. As that may be, you haven't provided any where near enough information to go further than this.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •