Re: Programing help read USB Joystick using gcc

Top Page
Attachments:
Message as email
+ (text/plain)
+ signature.asc (application/pgp-signature)
+ (text/plain)
Delete this message
Reply to this message
Author: Joseph Sinclair
Date:  
To: Main PLUG discussion list
Subject: Re: Programing help read USB Joystick using gcc
Sounds like what you need to do is very similar to writing a custom driver for your joystick in an embedded environment.
You'll probably need to do something similar to the following:
1) A library for usb interface in your environment
a) libusb provides a low-level interface to USB data for Linux, but it requires the Linux kernel to provide the host controller drivers.
b) If you aren't developing under Linux, then check with your SBC vendor about drivers for their USB host controller.
2) If your environment doesn't already have a driver for your joystick, you need to find out what the joystick sends for commands and data; there are two common ways of doing this
a) Pull up a Linux driver for the joystick (if one exists) and use that code to determine the USB command and data structures (easier)
b) use a USB snoop device to reverse-engineer the interface for your joystick (much harder)
3) Write the code needed to interface with the joystick
a) If you do not already have a driver available, write a driver for your environment, and connect that to your ROV control code.
b) Write code using libusb that interfaces with your joystick using an existing Linux driver.

This page is a good starting point for developing any USB interface code, whether in Linux or otherwise:
http://www.linux-usb.org/

Hopefully that helps.

Mike Bushroe wrote:
>      I have been trying unsuccessfully for some time to figure out how to
> read the analog axes and digital buttons on one or more USB joysticks
> connected to a computer with an open source programming language like C
> compiled by gcc. I have no idea what library needs to be added, if any. I
> also have no idea what the function call names or parameters are. I have
> tried Googling USB Joystick, but mostly what I find is how to convert an
> older game console into a USB device. Can someone point me to required
> libraries, header files with function calls, or better yet sample code? Or
> is there a different listserver that has people that can more easily answer
> questions like this?

>
>
>      I am trying to write a program to send serial command data to a
> microcontroller to operate an underwater ROV using the joysticks to control
> movement and manipulator arms, and buttons to control lights, secondary
> cameras, ballast tanks, etc. But without a way to read human input, I don't
> have any data to convert into motor commands to control the movement of the
> ROV.

>
> Mike
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss