From e0166256ff479c48a4ecae76fff5a370671b2c41 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 15 Nov 2024 17:53:59 -0600 Subject: [PATCH] joystick: Fix connection type for Steam Controller and Xbox 360 dongles --- src/joystick/hidapi/SDL_hidapi_steam.c | 4 ++++ src/joystick/hidapi/SDL_hidapi_xbox360w.c | 1 + 2 files changed, 5 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c index 68fb01017b..796c709b3a 100644 --- a/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/src/joystick/hidapi/SDL_hidapi_steam.c @@ -1153,6 +1153,10 @@ static bool HIDAPI_DriverSteam_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joyst joystick->naxes = SDL_GAMEPAD_AXIS_COUNT; joystick->nhats = 1; + if (IsDongle(device->product_id)) { + joystick->connection_state = SDL_JOYSTICK_CONNECTION_WIRELESS; + } + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, update_rate_in_hz); SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, update_rate_in_hz); diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/src/joystick/hidapi/SDL_hidapi_xbox360w.c index b1114f030d..1d2a1ee909 100644 --- a/src/joystick/hidapi/SDL_hidapi_xbox360w.c +++ b/src/joystick/hidapi/SDL_hidapi_xbox360w.c @@ -178,6 +178,7 @@ static bool HIDAPI_DriverXbox360W_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Jo joystick->nbuttons = 11; joystick->naxes = SDL_GAMEPAD_AXIS_COUNT; joystick->nhats = 1; + joystick->connection_state = SDL_JOYSTICK_CONNECTION_WIRELESS; return true; }