Re: Fixes to Gnome gvfs pushed into 3.22
Hi Mark and others,
I was trying to backports these patch myself today !
So thanks for the pointer to the correct commits on gnome-3-22.
Here is the patch to put into debian/patches.
I've just tested it right now, and I can confirm it fixes the issue.
Best regards,
Jérémy
Description: fix mtp volume is not removed when unplugging
Applied fix to gnome 3.22 about bug 789491.
Author: Jérémy Viès <jeremy.vies@gmail.com>
Origin: upstream gnome/gvfs, https://github.com/GNOME/gvfs/commits/gnome-3-22
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=789491
Last-Update: 2018-04-03
--- gvfs-1.30.4.orig/monitor/gphoto2/ggphoto2volume.c
+++ gvfs-1.30.4/monitor/gphoto2/ggphoto2volume.c
@@ -421,7 +421,7 @@ g_gphoto2_volume_has_path (GGPhoto2Volum
G_LOCK (gphoto2_volume);
res = FALSE;
if (gphoto2_volume->device != NULL)
- res = strcmp (g_udev_device_get_sysfs_path (gphoto2_volume->device), sysfs_path) == 0;
+ res = g_strcmp0 (g_udev_device_get_sysfs_path (gphoto2_volume->device), sysfs_path) == 0;
G_UNLOCK (gphoto2_volume);
return res;
}
--- gvfs-1.30.4.orig/monitor/gphoto2/ggphoto2volumemonitor.c
+++ gvfs-1.30.4/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)
+ gudev_remove_camera (monitor, device);
+ else
+ g_debug ("on_uevent: discarding");
}
/* Find all attached gphoto supported cameras; this is called on startup
--- gvfs-1.30.4.orig/monitor/mtp/gmtpvolume.c
+++ gvfs-1.30.4/monitor/mtp/gmtpvolume.c
@@ -209,7 +209,7 @@ g_mtp_volume_has_path (GMtpVolume *volu
G_LOCK (mtp_volume);
res = FALSE;
if (mtp_volume->device != NULL)
- res = strcmp (g_udev_device_get_sysfs_path (mtp_volume->device), sysfs_path) == 0;
+ res = g_strcmp0 (g_udev_device_get_sysfs_path (mtp_volume->device), sysfs_path) == 0;
G_UNLOCK (mtp_volume);
return res;
}
--- gvfs-1.30.4.orig/monitor/mtp/gmtpvolumemonitor.c
+++ gvfs-1.30.4/monitor/mtp/gmtpvolumemonitor.c
@@ -208,17 +208,12 @@ on_uevent (GUdevClient *client, gchar *a
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_MTP_DEVICE"))
- {
- g_debug ("on_uevent: discarding, not ID_MTP");
- return;
- }
-
- if (strcmp (action, "add") == 0)
- gudev_add_device (monitor, device, TRUE);
- else if (strcmp (action, "remove") == 0)
- gudev_remove_device (monitor, device);
+ if (g_strcmp0 (action, "add") == 0 && g_udev_device_has_property (device, "ID_MTP_DEVICE"))
+ gudev_add_device (monitor, device, TRUE);
+ else if (g_strcmp0 (action, "remove") == 0)
+ gudev_remove_device (monitor, device);
+ else
+ g_debug ("on_uevent: discarding");
}
static void
Reply to: