hidapi/libusb: enable support for Xbox 360 and Xbox One controllers #572
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!572
Loading…
Reference in a new issue
No description provided.
Delete branch "0001-hidapi-libusb-enable-support-for-Xbox-360-and-Xbox-O.patch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Xbox controllers are not technically HID devices, but you can talk to them directly using libusb, and SDL uses this to talk to controllers which may not have OS-level support.
This pull request depends on https://github.com/libusb/hidapi/pull/568, which must be merged before this will pass.
@slouken
There are warnings treated as errors so that ubuntu-cmake github action failed. Please help to fix. Thanks.
I fixed the warnings, and I'll squash the PR once the build passes. There's still one error left that requires #568 to be merged first.
All ready to go!
@ -678,0 +736,4 @@0x10f5, /* Turtle Beach */0x1532, /* Razer Wildcat */0x20d6, /* PowerA */0x24c6, /* PowerA */looks like some debug code
remove?
@ -987,0 +1139,4 @@if (res < 0) {LOG("xbox init: can't set alt setting %d: %d\n", intf_desc->bInterfaceNumber, res);}zero-initialize the
dataotherwise,
libusb_control_transfermay try to read it, which is undefined behavior@ -678,0 +736,4 @@0x10f5, /* Turtle Beach */0x1532, /* Razer Wildcat */0x20d6, /* PowerA */0x24c6, /* PowerA */please don't use
UPPER_SNAKE_CASEfor named constants - it is generally error-prone in C/C++ due to fact that usually it is used for macroshere and elsewhere
@ -987,0 +1139,4 @@if (res < 0) {LOG("xbox init: can't set alt setting %d: %d\n", intf_desc->bInterfaceNumber, res);}I'm pretty sure if we're passing the
libusb_config_descriptor *conf_desc-int config_numberis redundantlets omit it
Does SDL users ever use hidraw backend on Linux for devices like this?
@ -678,0 +736,4 @@0x10f5, /* Turtle Beach */0x1532, /* Razer Wildcat */0x20d6, /* PowerA */0x24c6, /* PowerA */I uncomment this frequently for debugging purposes. I can remove it from this PR if you like.
No, hidraw doesn't expose Xbox controllers.
@ -678,0 +736,4 @@0x10f5, /* Turtle Beach */0x1532, /* Razer Wildcat */0x20d6, /* PowerA */0x24c6, /* PowerA */at least make it a
/* C comment */(our code-style agreement)or hide it under
#if 0@ -678,0 +736,4 @@0x10f5, /* Turtle Beach */0x1532, /* Razer Wildcat */0x20d6, /* PowerA */0x24c6, /* PowerA */Would this be the preferred naming convention for these constants?
@ -678,0 +736,4 @@0x10f5, /* Turtle Beach */0x1532, /* Razer Wildcat */0x20d6, /* PowerA */0x24c6, /* PowerA */yes
This has been updated with the suggestions.