SDL: Use the correct name for the DualSense controllers

From 9a6bcca6b8db999217f157dab8c44bf27b0a8eb4 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 7 Dec 2022 14:53:33 -0800
Subject: [PATCH] Use the correct name for the DualSense controllers

---
 src/joystick/SDL_joystick.c          | 2 +-
 src/joystick/hidapi/SDL_hidapi_ps5.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 85217b65df89..f42324109b69 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -1809,7 +1809,7 @@ SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, c
             name = SDL_strdup("PS4 Controller");
             break;
         case SDL_CONTROLLER_TYPE_PS5:
-            name = SDL_strdup("PS5 Controller");
+            name = SDL_strdup("DualSense Wireless Controller");
             break;
         case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO:
             name = SDL_strdup("Nintendo Switch Pro Controller");
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index feb2f9a39c31..651ea52707e5 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -480,7 +480,11 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
     device->joystick_type = joystick_type;
     device->type = SDL_CONTROLLER_TYPE_PS5;
     if (device->vendor_id == USB_VENDOR_SONY) {
-        HIDAPI_SetDeviceName(device, "PS5 Controller");
+        if (SDL_IsJoystickDualSenseEdge(device->vendor_id, device->product_id)) {
+            HIDAPI_SetDeviceName(device, "DualSense Edge Wireless Controller");
+        } else {
+            HIDAPI_SetDeviceName(device, "DualSense Wireless Controller");
+        }
     }
     HIDAPI_SetDeviceSerial(device, serial);