[gvfs/gnome-3-22] gphoto2: Fix volume removal with current udev behavior
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-22] gphoto2: Fix volume removal with current udev behavior
- Date: Tue, 3 Apr 2018 14:29:19 +0000 (UTC)
commit 50e251b1a7349330190560aa4d3e19cad6fe2472
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 9b8f333..13c41a5 100644
--- a/monitor/gphoto2/ggphoto2volumemonitor.c
+++ b/monitor/gphoto2/ggphoto2volumemonitor.c
@@ -290,17 +290,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]