unbit / foohid-py

Python wrapper for the foohid OSX driver
MIT License
18 stars 6 forks source link

Usage for Joypad buttons and axes? #1

Closed trevor403 closed 9 years ago

trevor403 commented 9 years ago

From the USB HID descriptor you put in test_joypad I was able to decipher that there are 16 buttons on the sample joypad. I could not understand how you designate new axes but I assume it has to do with the 0x09 descriptor. More documentation on what each descriptor and value means for the Joypad would be of great help. Also documentation on the struct.pack format required to update the entire Joypad would be of great help. This kernel extension is marvelous but it needs more documentation.

unbit commented 9 years ago

The "emulated" joypad is a wii classic controller like described here:

http://www.instructables.com/id/USB-Wii-Classic-Controller/step5/USB-HID-Reports-and-Report-Descriptors/

The c struct is

struct joypad {
        uint16_t buttons_mask;
        uint8_t axis1_x;
        uint8_t axis1_y;
        uint8_t axis2_x;
        uint8_t axis2_y;
}
trevor403 commented 9 years ago

Bit Chart

trevor403 commented 9 years ago

Thank you, the I can figure out the rest using the struct module documentation.