-
Notifications
You must be signed in to change notification settings - Fork 2.2k
add 8BitDo Controller #12964
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 8BitDo Controller #12964
Conversation
add SN30 Pro, SF30 Pro, Pro 2. Supported versions: Pro 2 v3.06 above SF30 Pro/SN30 Pro v2.05 above
device->product_id == USB_PRODUCT_8BITDO_SF30_Pro || device->product_id == USB_PRODUCT_8BITDO_Pro_2 || | ||
device->product_id == USB_PRODUCT_8BITDO_Pro_2_BT) { | ||
Uint8 data[USB_PACKET_LENGTH]; | ||
int size = ReadFeatureReport(device->dev, 0x06, data, sizeof(data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make a define at the top of the file instead of hard-coding the number here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
@@ -236,7 +256,7 @@ static void HIDAPI_Driver8BitDo_HandleStatePacket(SDL_Joystick *joystick, SDL_Dr | |||
{ | |||
Sint16 axis; | |||
Uint64 timestamp = SDL_GetTicksNS(); | |||
if (data[0] != 0x03 && data[0] != 0x01) { | |||
if (data[0] != 0x03 && data[0] != 0x01 && data[0] != 0x04) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the first byte vary depending on controller type? Maybe we should add the report ID as part of the SDL_Driver8BitDo_Context structure and validate that the packet matches the expected value for the current controller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not the type of controller, but the 0x04 report Id created for SN30 PRO/SF30 PRO/PRO 2 compatibility with previous versions of the report Id.
In the future, products that are compatible with SDL will be adapted using the 0x04 report Id.
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Co-authored-by: Sam Lantinga <slouken@libsdl.org>
Merged, thanks! |
add SN30 Pro, SF30 Pro, Pro 2.
Supported versions:
Pro 2 v3.06 and above
SF30 Pro/SN30 Pro v2.05 and above