USB HID documentation?

E

ETP

I have a little robot project I'm programming in python using the
Lynxmotion SSC-32 servo controller via serial. I'd like to use a USB
game controller (PS2 style) to control the robot.

I've read a number of threads about the difficulty of using USB
without extensive understanding of the way it works, but a few have
stated that HID is different somehow. I definitely do not have any
USB knowledge, and I don't care to get into that. However, if USB-HID
is much simpler I would love to learn.

I have the python extensions for windows:
http://sourceforge.net/project/showfiles.php?group_id=78018
but I haven't found any documentation on how to implement HID in
python. Can anyone give me some examples or links?

Thanks much.
 
D

Diez B. Roggisch

ETP said:
I have a little robot project I'm programming in python using the
Lynxmotion SSC-32 servo controller via serial. I'd like to use a USB
game controller (PS2 style) to control the robot.

I've read a number of threads about the difficulty of using USB
without extensive understanding of the way it works, but a few have
stated that HID is different somehow. I definitely do not have any
USB knowledge, and I don't care to get into that. However, if USB-HID
is much simpler I would love to learn.

I have the python extensions for windows:
http://sourceforge.net/project/showfiles.php?group_id=78018
but I haven't found any documentation on how to implement HID in
python. Can anyone give me some examples or links?

You seem to misunderstand HID. HID is a protocol over USB (and Bluetooth I
believe) that will create user input device events which are mapped to your
OS input layer. That means that whenever you e.g. attach a keyboard device,
it's keyboard events will generate key-strokes on screen.

There are various kinds of HID-devices, and gamepads/joysticks generate
certain events.

So you need to look up you OS game device API and use that. Then attaching
any compliant HID-device should work.

Diez
 
E

ETP

I don't doubt I misunderstand since most programming jargon goes over
my head.

That said, I'm sure you can guess my OS is Windows and I don't know
what an API is. After a quick search it looks like windows uses
something called DirectInput for gaming devices. Is anyone familiar
with DirectInput? Is it implementable in Python?

Here's my source: http://msdn.microsoft.com/en-us/library/bb219802(VS.85).aspx

Actually, I found this, too: http://directpython.sourceforge.net/

Sounds like it is very straight forward. i would definitely still
appreciate any comments or suggestions on the best way to implement a
game controller.

Thanks again.
 
T

Tim Roberts

Diez B. Roggisch said:
You seem to misunderstand HID. HID is a protocol over USB (and Bluetooth I
believe) that will create user input device events which are mapped to your
OS input layer. That means that whenever you e.g. attach a keyboard device,
it's keyboard events will generate key-strokes on screen.

No, it's more than that. HID devices that are not of a type directly
claimed by the operating system (keyboards, mice) can be accessed by
user-mode programs very easily on both Linux and Windows, without writing a
custom driver. For low-bandwidth data sources, USB HID is an excellent way
to provide general-purpose access to a USB device.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top