mirror of https://github.com/encounter/SDL.git
Don't send rumble to the Amazon Luna controller on macOS
Sending rumble to the Amazon Luna controller on macOS gets there, but IOHIDDeviceSetReport() blocks for a long time and eventually fails. This appears to be a bug in the macOS Bluetooth stack, ref rdar://99265496
This commit is contained in:
parent
02bc359b64
commit
2e3b4f3fd7
|
@ -35,6 +35,11 @@
|
||||||
/* Define this if you want to log all packets from the controller */
|
/* Define this if you want to log all packets from the controller */
|
||||||
/*#define DEBUG_LUNA_PROTOCOL*/
|
/*#define DEBUG_LUNA_PROTOCOL*/
|
||||||
|
|
||||||
|
/* Sending rumble on macOS blocks for a long time and eventually fails */
|
||||||
|
#if !defined(__MACOSX__)
|
||||||
|
#define ENABLE_LUNA_BLUETOOTH_RUMBLE
|
||||||
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SDL_CONTROLLER_BUTTON_LUNA_MIC = 15,
|
SDL_CONTROLLER_BUTTON_LUNA_MIC = 15,
|
||||||
|
@ -119,6 +124,7 @@ HIDAPI_DriverLuna_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick
|
||||||
static int
|
static int
|
||||||
HIDAPI_DriverLuna_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
HIDAPI_DriverLuna_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
|
||||||
{
|
{
|
||||||
|
#ifdef ENABLE_LUNA_BLUETOOTH_RUMBLE
|
||||||
if (device->product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER) {
|
if (device->product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER) {
|
||||||
/* Same packet as on Xbox One controllers connected via Bluetooth */
|
/* Same packet as on Xbox One controllers connected via Bluetooth */
|
||||||
Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xEB };
|
Uint8 rumble_packet[] = { 0x03, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xEB };
|
||||||
|
@ -132,10 +138,11 @@ HIDAPI_DriverLuna_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
|
||||||
/* FIXME: Is there a rumble packet over USB? */
|
|
||||||
return SDL_Unsupported();
|
|
||||||
}
|
}
|
||||||
|
#endif /* ENABLE_LUNA_BLUETOOTH_RUMBLE */
|
||||||
|
|
||||||
|
/* There is currently no rumble packet over USB */
|
||||||
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -149,9 +156,11 @@ HIDAPI_DriverLuna_GetJoystickCapabilities(SDL_HIDAPI_Device *device, SDL_Joystic
|
||||||
{
|
{
|
||||||
Uint32 result = 0;
|
Uint32 result = 0;
|
||||||
|
|
||||||
|
#ifdef ENABLE_LUNA_BLUETOOTH_RUMBLE
|
||||||
if (device->product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER) {
|
if (device->product_id == BLUETOOTH_PRODUCT_LUNA_CONTROLLER) {
|
||||||
result |= SDL_JOYCAP_RUMBLE;
|
result |= SDL_JOYCAP_RUMBLE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue