We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4549 - [Patch] Add support for official Nintendo USB GameCube adapter
Summary: [Patch] Add support for official Nintendo USB GameCube adapter
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-13 00:34 UTC by Ethan Lee
Modified: 2019-04-17 02:36 UTC (History)
1 user (show)

See Also:


Attachments
Patch to add HIDAPI support for WUP-028 (51.71 KB, patch)
2019-03-13 00:34 UTC, Ethan Lee
Details | Diff
Patch to add L/R buttons (1.45 KB, patch)
2019-03-17 16:38 UTC, Ethan Lee
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ethan Lee 2019-03-13 00:34:22 UTC
Created attachment 3697 [details]
Patch to add HIDAPI support for WUP-028

Attached is a patch to add HIDAPI-based support for Nintendo's USB GameCube controller adapter for Wii U and Nintendo Switch.

Currently this is only supported on Linux due to the bogus HID information that the hardware returns, meaning the macOS/Windows HID drivers intercept the device only to do nothing with them while preventing us from reading the device ourselves. This can be fixed by introducting hidapi-libusb support for all platforms (not just Linux) but that's a different patch for another day.

The main concern here is the DeviceDriver rewrite - to support all 4 slots, I had to completely redo the function table to bring the joystick enumeration into the driver itself. It makes sense for the GameCube adapter, but obviously all the other drivers will just care about the one joystick per device. I _think_ I updated everything correctly, but this will need a fair amount of testing first.
Comment 1 Sam Lantinga 2019-03-17 01:10:15 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/64597a7e8771
Comment 2 Ethan Lee 2019-03-17 16:38:30 UTC
Created attachment 3699 [details]
Patch to add L/R buttons

Oh wow, that was fast...

As a bonus, here's one more patch to add the bottom L/R buttons to the joystick. GameController won't use them, but maybe someone will find them useful anyway.
Comment 3 Ethan Lee 2019-04-15 20:20:18 UTC
Totally forgot about this... reopening so I don't forget about attachment 3699 [details] again.
Comment 4 Sam Lantinga 2019-04-17 02:36:48 UTC
Added, thanks!
https://hg.libsdl.org/SDL/rev/704ec541957d