Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I know this isn't SO, but it's a fairly niche space and someone might be able to answer this #1500

Open
rlewkowicz opened this issue Apr 25, 2024 Discussed in #1499 · 0 comments

Comments

@rlewkowicz
Copy link

There is no bug template so I feel like this is fair game for visibility.

Discussed in #1499

Originally posted by rlewkowicz April 25, 2024
TLDR: Is the 360 controller right joystick x/y 16 bits?

I dumped the report descriptor for a 360 controller and I'm still trying to understand what I'm looking at.

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x05,        // Usage (Game Pad)
0xA1, 0x01,        // Collection (Application)
0x09, 0x00,        //   Usage (Undefined)
0xA1, 0x00,        //   Collection (Physical)
0x09, 0x30,        //     Usage (X)
0x15, 0x00,        //     Logical Minimum (0)
0x35, 0x00,        //     Physical Minimum (0)
0x65, 0x00,        //     Unit (None)
0x55, 0x00,        //     Unit Exponent (0)
0x75, 0x10,        //     Report Size (16)
0x95, 0x01,        //     Report Count (1)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x31,        //     Usage (Y)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC1, 0x00,        //   End Collection
0x09, 0x00,        //   Usage (Undefined)
0xA1, 0x00,        //   Collection (Physical)
0x09, 0x33,        //     Usage (Rx)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x34,        //     Usage (Ry)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC1, 0x00,        //   End Collection
0x09, 0x00,        //   Usage (Undefined)
0xA1, 0x00,        //   Collection (Physical)
0x09, 0x32,        //     Usage (Z)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC1, 0x00,        //   End Collection
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x0A,        //   Usage Maximum (0x0A)
0x25, 0x01,        //   Logical Maximum (1)
0x45, 0x01,        //   Physical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x0A,        //   Report Count (10)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01,        //   Usage Page (Generic Desktop Ctrls)
0x09, 0x39,        //   Usage (Hat switch)
0x15, 0x01,        //   Logical Minimum (1)
0x25, 0x08,        //   Logical Maximum (8)
0x46, 0x3B, 0x10,  //   Physical Maximum (4155)
0x65, 0x0E,        //   Unit (None)
0x75, 0x04,        //   Report Size (4)
0x95, 0x01,        //   Report Count (1)
0x81, 0x42,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x45, 0x01,        //   Physical Maximum (1)
0x65, 0x00,        //   Unit (None)
0x75, 0x01,        //   Report Size (1)
0x95, 0x12,        //   Report Count (18)
0x81, 0x03,        //   Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC1, 0x00,        // End Collection

// 107 bytes

// best guess: USB HID Report Descriptor

Right here is what I'm trying to figure out:

0x09, 0x33,        //     Usage (Rx)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x34,        //     Usage (Ry)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)

Lets move the right joystick all the way up and actually look at the report that is sent:

00 14 00 00 00 00 00 00 00 00 a1 3f ff 7f 00 00 00 00 00 00

a1 3f ff 7f is our right joystick. Now I can decode a portion of this into 8 bits and get the expected -127/127 etc. But there's 2 other bits that move. So you'd think it's 16, but I think 30k is supposed to be the middle and in my testing it just doesn't line up right.

Can anyone tell me what a1 3f ff 7f is?

@rlewkowicz rlewkowicz changed the title I know this isn't SO, but it's a failry niche space and someone might be able to answer this I know this isn't SO, but it's a fairly niche space and someone might be able to answer this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant