Browse Source

evdev: fixed devices not being removed on disconnect

Sam Lantinga 5 months ago
parent
commit
ba1412cb9f
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/core/linux/SDL_udev.c

+ 7 - 3
src/core/linux/SDL_udev.c

@@ -487,9 +487,13 @@ static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev)
         return;
     }
 
-    devclass = device_class(dev);
-    if (!devclass) {
-         return;
+    if (type == SDL_UDEV_DEVICEADDED) {
+        devclass = device_class(dev);
+        if (!devclass) {
+            return;
+        }
+    } else {
+        // The device has been removed, the class isn't available
     }
 
     // Process callbacks