瀏覽代碼

Fixed PlayStation detection interrupting input for the Logitech K400 keyboard

Also added the Logitech Chillstream to the list of PS3 controllers and fixed the right shoulder axis.
Sam Lantinga 1 年之前
父節點
當前提交
b6d7adfec1
共有 3 個文件被更改,包括 17 次插入15 次删除
  1. 1 0
      src/joystick/controller_list.h
  2. 6 1
      src/joystick/hidapi/SDL_hidapi_ps3.c
  3. 10 14
      src/joystick/hidapi/SDL_hidapijoystick.c

+ 1 - 0
src/joystick/controller_list.h

@@ -24,6 +24,7 @@ static const ControllerDescription_t arrControllers[] = {
 	{ MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL },	// From SDL
 	{ MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL },	// Firestorm Dual Analog 3
 	{ MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL },	// Thrustmaster wireless 3-1
+	{ MAKE_CONTROLLER_ID( 0x046d, 0xcad1 ), k_eControllerType_PS3Controller, NULL },	// Logitech Chillstream
 	//{ MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL },	// Logitech G29 (PS3)
 	{ MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL },	// Sony PS3 Controller
 	{ MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL },	// From SDL

+ 6 - 1
src/joystick/hidapi/SDL_hidapi_ps3.c

@@ -619,6 +619,11 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_IsSupportedDevice(SDL_HIDAPI_Device *
     Uint8 data[USB_PACKET_LENGTH];
     int size;
 
+    if (vendor_id == USB_VENDOR_LOGITECH &&
+        product_id == USB_PRODUCT_LOGITECH_CHILLSTREAM) {
+        return SDL_TRUE;
+    }
+
     if ((type == SDL_GAMEPAD_TYPE_PS3 && vendor_id != USB_VENDOR_SONY) ||
         HIDAPI_SupportsPlaystationDetection(vendor_id, product_id)) {
         if (device && device->dev) {
@@ -795,7 +800,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(SDL_Joystick *joystic
             0,  /* SDL_GAMEPAD_BUTTON_LEFT_STICK */
             0,  /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */
             14, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */
-            16, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
+            15, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */
             8,  /* SDL_GAMEPAD_BUTTON_DPAD_UP */
             9,  /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */
             7,  /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */

+ 10 - 14
src/joystick/hidapi/SDL_hidapijoystick.c

@@ -152,16 +152,12 @@ SDL_bool HIDAPI_SupportsPlaystationDetection(Uint16 vendor, Uint16 product)
     case USB_VENDOR_HORI:
         return SDL_TRUE;
     case USB_VENDOR_LOGITECH:
-        /* Most Logitech devices are fine with this, but there are a few exceptions */
-        if (product == USB_PRODUCT_LOGITECH_F310) {
-            /* The Logitech F310 gamepad will lock up */
-            return SDL_FALSE;
-        }
-        if (product == 0xc33f) {
-            /* The Logitech G815 keyboard will reset the LEDs */
-            return SDL_FALSE;
-        }
-        return SDL_TRUE;
+        /* Most Logitech devices are not PlayStation controllers, and some of them
+         * lock up or reset when we send them the Sony third-party query feature
+         * report, so don't include that vendor here. Instead add devices as
+         * appropriate to controller_list.h
+         */
+        return SDL_FALSE;
     case USB_VENDOR_MADCATZ:
         if (product == USB_PRODUCT_MADCATZ_SAITEK_SIDE_PANEL_CONTROL_DECK) {
             /* This is not a Playstation compatible device */
@@ -182,10 +178,10 @@ SDL_bool HIDAPI_SupportsPlaystationDetection(Uint16 vendor, Uint16 product)
     case USB_VENDOR_QANBA:
         return SDL_TRUE;
     case USB_VENDOR_RAZER:
-        /* Most Razer devices are not game controllers, and some of them lock up
-         * or reset when we send them the Sony third-party query feature report,
-         * so don't include that vendor here. Instead add devices as appropriate
-         * to controller_list.h
+        /* Most Razer devices are not PlayStation controllers, and some of them
+         * lock up or reset when we send them the Sony third-party query feature
+         * report, so don't include that vendor here. Instead add devices as
+         * appropriate to controller_list.h
          *
          * Reference: https://github.com/libsdl-org/SDL/issues/6733
          *            https://github.com/libsdl-org/SDL/issues/6799