A
A
AJ2012-09-02 22:22:31
Do it yourself
AJ, 2012-09-02 22:22:31

How to read data from the gamepad?

Good Khabrovites.
I have a gamepad that I would like to use to control my projects. Gamepad with mushrooms and buttons, like PS-shnogo. I sit and think: how to read what he sends via USB, so that later I can code the reader of his commands and use it for my own purposes. And if with buttons, more or less, it’s clear, then with fungi, not so much. There must be a range. In general, I really want to read what he sends to the computer, and then teach him how to read the program.
There are, of course, programs that reassign actions from the gamepad to the keyboard, but you need to implement everything in your project.
Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Arsen Adzhiametov, 2012-09-03
@Kalpazan

Damn, why the complexity of divination xinput or direct?
write what kind of gamepad you have and everything will be clear immediately

T
timon_sk, 2012-09-02
@timon_sk

If the gamepad supports XInput, then you can use the library of the same name included in the DirectX SDK. there is an example of using
http://www.codeproject.com/articles/26949/xbox-360-controller-input-in-c-with-xinput

M
m08pvv, 2012-09-02
@m08pvv

Most likely it is a HID device, which means it sends the number of buttons and axes, as well as their state.

S
S1ashka, 2012-09-02
@S1ashka

usb sniffer

B
bagyr, 2012-09-03
@bagyr

It is possible cross-platform and rather simply through SDL/Allegro.
USB is sniffed nicely by Wireshark.

A
Ariman, 2012-09-03
@Ariman

I use Device Monitoring Studio to capture USB packets.
The gamepad is most likely HID.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question