After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793925 - Ignore unsupported devices
Ignore unsupported devices
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: mtp backend
unspecified
Other All
: Normal normal
: ---
Assigned To: Philip Langdale
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2018-02-28 16:09 UTC by Bastien Nocera
Modified: 2018-03-01 16:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mtp: Fix warning to include interesting information (1.57 KB, patch)
2018-02-28 16:09 UTC, Bastien Nocera
reviewed Details | Review
mtp: Ignore unsupported devices (1.55 KB, patch)
2018-02-28 16:09 UTC, Bastien Nocera
none Details | Review
gphoto2: Ignore devices without a device file (2.01 KB, patch)
2018-03-01 10:09 UTC, Bastien Nocera
none Details | Review
mtp: Ignore devices without a device file (1.76 KB, patch)
2018-03-01 10:09 UTC, Bastien Nocera
committed Details | Review
gphoto2: Ignore devices without a device file (2.32 KB, patch)
2018-03-01 16:33 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2018-02-28 16:09:02 UTC
.
Comment 1 Bastien Nocera 2018-02-28 16:09:07 UTC
Created attachment 369104 [details] [review]
mtp: Fix warning to include interesting information

This warning is not interesting at all:
GVFS-MTP-WARNING **: device (null) has no BUSNUM property, ignoring

If there's no BUSNUM, there might not be a device file either, which
makes the problematic device impossible to pinpoint. Print the sysfs
path instead, which will always be filled in.
Comment 2 Bastien Nocera 2018-02-28 16:09:14 UTC
Created attachment 369105 [details] [review]
mtp: Ignore unsupported devices

Devices which don't have either of BUSNUM or DEVNUM properties, but have
ID_MTP_DEVICE tags usually are children devices of the main MTP device.
Ignore them silently rather than throwing warnings in the journal.
Comment 3 Ondrej Holy 2018-02-28 17:42:18 UTC
Review of attachment 369104 [details] [review]:

Can't we ignore all devices without device file in on_uevent at all instead of this? Seems that mtp/gphoto2 backends rely on device files anyway...

This definitely needs fixes also for gphoto2 monitor, which contains more-or-less the same code.
Comment 4 Bastien Nocera 2018-03-01 10:09:18 UTC
Created attachment 369140 [details] [review]
gphoto2: Ignore devices without a device file

If there's no device file, which means libusb won't be able to open the
device, no need to print a warning, simply ignore the device.
Comment 5 Bastien Nocera 2018-03-01 10:09:24 UTC
Created attachment 369141 [details] [review]
mtp: Ignore devices without a device file

If there's no device file, which means libusb won't be able to open the
device, no need to print a warning, simply ignore the device.
Comment 6 Ondrej Holy 2018-03-01 15:04:33 UTC
Review of attachment 369140 [details] [review]:

Looks ok, just...

::: monitor/gphoto2/ggphoto2volumemonitor.c
@@ +160,3 @@
     usb_bus_num = g_udev_device_get_property (device, "BUSNUM");
     if (usb_bus_num == NULL) {
+	g_warning("device %s has no BUSNUM property, ignoring", device_path);

...please also fix the coding style in those lines (replace tabs by spaces, add missing space before parenthesis...).
Comment 7 Ondrej Holy 2018-03-01 15:04:35 UTC
Review of attachment 369141 [details] [review]:

Looks ok, thanks!
Comment 8 Bastien Nocera 2018-03-01 16:33:35 UTC
Created attachment 369151 [details] [review]
gphoto2: Ignore devices without a device file

If there's no device file, which means libusb won't be able to open the
device, no need to print a warning, simply ignore the device.
Comment 9 Bastien Nocera 2018-03-01 16:36:16 UTC
Attachment 369141 [details] pushed as 7a6fd7b - mtp: Ignore devices without a device file
Attachment 369151 [details] pushed as 9762917 - gphoto2: Ignore devices without a device file