[gvfs/gnome-3-26] gphoto2: Fix volume removal with current udev behavior



commit bcd2a7ac00b5d6cd82e8ddfe9481da8edfe59e6a
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Oct 27 10:11:20 2017 +0200

    gphoto2: Fix volume removal with current udev behavior
    
    UDev events for devices without ID_GPHOTO2 property are ignored.
    Although ID_GPHOTO2 seems don't have to be set for device when removing
    and thus the volume is not removed. Let's ignore ID_GPHOTO2 when removing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789491

 monitor/gphoto2/ggphoto2volumemonitor.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/monitor/gphoto2/ggphoto2volumemonitor.c b/monitor/gphoto2/ggphoto2volumemonitor.c
index f4fae8b..06e07ab 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -246,17 +246,12 @@ on_uevent (GUdevClient *client,
 
   /* g_debug ("on_uevent: action=%s, device=%s", action, g_udev_device_get_device_file(device)); */
 
-  /* filter out uninteresting events */
-  if (!g_udev_device_has_property (device, "ID_GPHOTO2"))
-    {
-      /* g_debug ("on_uevent: discarding, not ID_GPHOTO2"); */
-      return;
-    }
-
-  if (strcmp (action, "add") == 0)
-     gudev_add_camera (monitor, device, TRUE); 
-  else if (strcmp (action, "remove") == 0)
-     gudev_remove_camera (monitor, device); 
+  if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_GPHOTO2"))
+    gudev_add_camera (monitor, device, TRUE);
+  else if (g_strcmp0 (action, "remove") == 0 && g_udev_device_get_device_file (device) != NULL)
+    gudev_remove_camera (monitor, device);
+  else
+    g_debug ("on_uevent: discarding");
 }
 
 /* Find all attached gphoto supported cameras; this is called on startup


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]