SDL: Don't trigger device notifications when Steam Deck backlight changes

From bef9f2b2c423d636e2388c62412c754f3bd45968 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 26 May 2022 20:45:13 -0700
Subject: [PATCH] Don't trigger device notifications when Steam Deck backlight
 changes

---
 src/hidapi/SDL_hidapi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 9b25742f84e..3808ceba2ef 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -416,7 +416,10 @@ HIDAPI_UpdateDiscovery()
                     const char *action = NULL;
                     action = usyms->udev_device_get_action(pUdevDevice);
                     if (!action || SDL_strcmp(action, "add") == 0 || SDL_strcmp(action, "remove") == 0) {
-                        ++SDL_HIDAPI_discovery.m_unDeviceChangeCounter;
+                        const char *subsystem = usyms->udev_device_get_subsystem(pUdevDevice);
+                        if (!subsystem || SDL_strcmp(subsystem, "backlight") != 0) {
+                            ++SDL_HIDAPI_discovery.m_unDeviceChangeCounter;
+                        }
                     }
                     usyms->udev_device_unref(pUdevDevice);
                 }