[gvfs] gphoto2: Fix volume removal with current udev behavior
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] gphoto2: Fix volume removal with current udev behavior
- Date: Fri, 27 Oct 2017 09:26:12 +0000 (UTC)
commit 9f8561de232332979bedfea94b1df927f271d070
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]