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

Add support for 045e:0202 duke xbox controller and fix analog hat readings #818

Merged

Conversation

herraa1
Copy link
Contributor

@herraa1 herraa1 commented Jul 14, 2024

The current code uses hardcoded endpoints to read/write to original Xbox controllers. This works for controllers like 045e:0289 which uses the same endpoint configuration as the hardcoded one.

045e_0289_device_descriptor
045e_0289_config_descriptor

But other original Xbox controllers like 045e:0202 do not follow the hardcoded configuration and end up not working (can't read reports from them).

045e_0202_device_descriptor
045e_0202_config_descriptor

This PR modifies the XBOXOLD code to determine endpoints by reading configuration descriptors as in the XBOXONE, instead of hardcoding them. This makes both kind of controllers work.
On this same PR a patch to properly read the left and right analog hats is included too.

XBOXOLD.cpp Show resolved Hide resolved
XBOXOLD.cpp Outdated Show resolved Hide resolved
Usb.cpp Show resolved Hide resolved
@herraa1
Copy link
Contributor Author

herraa1 commented Jul 15, 2024

I've submitted two additional commits to the PR to fix the indicated concerns (printReport open coding and analog hat endianness fix using void pointer arithmetic).

@herraa1
Copy link
Contributor Author

herraa1 commented Jul 16, 2024

Do you want me to squash the fixes for raised concerts into the feature commits to keep history simple and avoid non-working points in repository history? (I'm not so used to github and established workflows, although I have raw git experience).

The 045e:0202 "Microsoft X-Box pad v1 (US)" uses endpoint 2 both
for IN and OUT, while 045e:0289 "Microsoft X-Box pad v2 (US)"
uses endpoint 1 for IN and endpoint 2 for OUT.
Instead of hardcoding endpoints, read them from configuration
descriptors to make all controllers work.

Without this patch, 045e:0202 does not work.

Signed-off-by: Albert Herranz <[email protected]>
Properly read left and right analog hat values as 16bit little endian integers.

Signed-off-by: Albert Herranz <[email protected]>
@herraa1 herraa1 force-pushed the topic/fix-045e-0202-duke-xbox-controller branch from 13d42f4 to ca39e3a Compare July 21, 2024 21:21
@herraa1
Copy link
Contributor Author

herraa1 commented Jul 21, 2024

I ended up squashing the fixes into their original commits (rebase).
Please, let me know if you need something else before accepting the PR. Thanks.

Copy link
Collaborator

@Lauszus Lauszus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Lauszus
Copy link
Collaborator

Lauszus commented Jul 22, 2024

I ended up squashing the fixes into their original commits (rebase). Please, let me know if you need something else before accepting the PR. Thanks.

Looks great. Thanks for cleaning up the commits :)

@Lauszus
Copy link
Collaborator

Lauszus commented Jul 22, 2024

Btw don't worry about the CI. I'll fix that.

@Lauszus Lauszus merged commit 9324583 into felis:master Jul 23, 2024
21 of 60 checks passed
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

Successfully merging this pull request may close these issues.

2 participants