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 615743 - don't show mtp devices until successfully opened
don't show mtp devices until successfully opened
Status: RESOLVED OBSOLETE
Product: rhythmbox
Classification: Other
Component: Removable Media
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 638361 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-04-14 13:00 UTC by Martin Pitt
Modified: 2018-05-24 15:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
debug output (8.49 KB, text/plain)
2010-04-14 13:04 UTC, Martin Pitt
  Details
Ignore PTP cameras (2.80 KB, patch)
2010-04-14 14:37 UTC, Martin Pitt
none Details | Review
fix memory leak (937 bytes, patch)
2010-04-14 14:48 UTC, Martin Pitt
committed Details | Review

Description Martin Pitt 2010-04-14 13:00:09 UTC
When I plug in my PTP camera, it appears in Rhythmbox as an audio device. Of course there aren't any songs on it, and it does not have any kind of music profile. Now, on a protocol level MTP and PTP are very similar, but my camera neither gets a /dev/libmtp* symlink (/lib/udev/rules.d/45-libmtp8.rules) nor an ID_MEDIA_PLAYER tag (from media-player-info). I think rhythmbox should ignore devices which don't have either.

For completeness, some data:

lsusb -vvv:
Bus 001 Device 014: ID 04a9:31c0 Canon, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x04a9 Canon, Inc.
  idProduct          0x31c0 
  bcdDevice            0.02
  iManufacturer           1 Canon Inc.
  iProduct                2 Canon Digital Camera
  iSerial                 3 C767F1C714174C309255F70E4A7B2EE2
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               9
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

gvfs-mount -li:

Volume(0): Canon Digital Camera
  Type: GProxyVolume (GProxyVolumeMonitorGPhoto2)
  ids:
   unix-device: '/dev/bus/usb/001/016'
  activation_root=gphoto2://[usb:001,016]/
  themed icons:  [camera-photo]
  can_mount=1
  can_eject=0
  should_automount=1
  Mount(0): Canon Digital Camera -> gphoto2://[usb:001,016]/
    Type: GProxyShadowMount (GProxyVolumeMonitorGPhoto2)
    default_location=gphoto2://[usb:001,016]/
    themed icons:  [camera-photo]
    x_content_types: x-content/image-dcf
    can_unmount=1
    can_eject=0
    is_shadowed=0
Mount(1): Canon Digital Camera -> gphoto2://[usb:001,016]/
  Type: GDaemonMount
  default_location=gphoto2://[usb:001,016]/
  themed icons:  [camera-photo]  [camera]
  x_content_types: x-content/image-dcf
  can_unmount=1
  can_eject=0
  is_shadowed=1

udev data:
P: /devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.3/1-8.3.3
N: bus/usb/001/016
S: char/189:15
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.3/1-8.3.3
E: MAJOR=189
E: MINOR=15
E: DEVNAME=/dev/bus/usb/001/016
E: DEVTYPE=usb_device
E: DRIVER=usb
E: PRODUCT=4a9/31c0/2
E: TYPE=0/0/0
E: BUSNUM=001
E: DEVNUM=016
E: SUBSYSTEM=usb
E: ID_VENDOR=Canon_Inc.
E: ID_VENDOR_ENC=Canon\x20Inc.
E: ID_VENDOR_ID=04a9
E: ID_MODEL=Canon_Digital_Camera
E: ID_MODEL_ENC=Canon\x20Digital\x20Camera
E: ID_MODEL_ID=31c0
E: ID_REVISION=0002
E: ID_SERIAL=Canon_Inc._Canon_Digital_Camera_C767F1C714174C309255F70E4A7B2EE2
E: ID_SERIAL_SHORT=C767F1C714174C309255F70E4A7B2EE2
E: ID_BUS=usb
E: ID_USB_INTERFACES=:060101:
E: ID_GPHOTO2=1
E: GPHOTO2_DRIVER=PTP
E: ACL_MANAGE=1
E: DEVLINKS=/dev/char/189:15
Comment 1 Martin Pitt 2010-04-14 13:01:40 UTC
The downstream bug (https://bugs.launchpad.net/rhythmbox/+bug/544994) has more confirmation about that.
Comment 2 Martin Pitt 2010-04-14 13:04:20 UTC
Created attachment 158715 [details]
debug output

Attaching the part of rhythmbox -d when switching on the camera.

Some interesting excerpts:

(14:52:54) [0x2273040] [uevent_cb] rb-removable-media-manager.c:591: add event for /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.3/1-8.3.3 (bd0d)
(14:52:54) [0x2273040] [create_source_device_cb] rb-mtp-plugin.c:368: trying to match device bd0d (usb device 14) against detected mtp devices
Device 0 (VID=04a9 and PID=31c0) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
(14:52:54) [0x2273040] [create_source_device_cb] rb-mtp-plugin.c:375: detected mtp device: device number 14
(14:52:54) [0x2273040] [create_source_device_cb] rb-mtp-plugin.c:381: device matched, creating a source
(14:52:54) [0x2273040] [rhythmdb_tree_entry_type_registered] rhythmdb-tree.c:2690: no entries of newly registered type MTP-1-14 loaded from db
[...]
(14:52:54) [0x2273040] [uevent_cb] rb-removable-media-manager.c:591: add event for /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8/1-8.3/1-8.3.3/1-8.3.3:1.0 (0)
(14:52:54) [0x2273040] [create_source_device_cb] rb-mtp-plugin.c:354: can't get udev device number for device 1-8.3.3:1.0
[...]
(14:52:55) [0x4378490] [run_task] rb-mtp-thread.c:534: running task: get track list

(rhythmbox:22866): Rhythmbox-WARNING **: libmtp error: PTP Layer error 2019: get_all_metadata_fast(): could not get proplist of all objects.

(rhythmbox:22866): Rhythmbox-WARNING **: libmtp error: (Look this up in ptp.h for an explanation.)
(14:52:55) [0x4378490] [get_track_list] rb-mtp-thread.c:345: No albums
(14:52:55) [0x4378490] [get_track_list] rb-mtp-thread.c:352: no tracks on the device
(14:52:55) [0x2273040] [device_opened_idle] rb-mtp-source.c:806: unknown libmtp filetype Audio Video Interleave supported
(14:52:55) [0x2273040] [device_opened_idle] rb-mtp-source.c:812: media type audio/x-wav supported
(14:52:55) [0x2273040] [device_opened_idle] rb-mtp-source.c:800: JPEG (album art) supported
Comment 3 Bastien Nocera 2010-04-14 14:15:03 UTC
No mention of which version of Rhythmbox you're using. This is most likely already fixed, ask Sebastien for updates on this problem.
Comment 4 Martin Pitt 2010-04-14 14:37:18 UTC
Created attachment 158721 [details] [review]
Ignore PTP cameras

I tested this patch with my Canon PowerShot SX200 (which previously appeared and is now igored) and with my Samsung U5, which is a proper MTP music player.
Comment 5 Martin Pitt 2010-04-14 14:48:03 UTC
(In reply to comment #3)
> No mention of which version of Rhythmbox you're using. This is most likely
> already fixed, ask Sebastien for updates on this problem.

oh, sorry; both 0.12.8, and trunk. Seb said that this was discussed a while ago, but no result yet, and I just pinged Christophe on IRC.
Comment 6 Martin Pitt 2010-04-14 14:48:40 UTC
Created attachment 158722 [details] [review]
fix memory leak

While I was working on this I noticed a memory leak. Simple patch attached.
Comment 7 Jonathan Matthew 2010-04-14 20:56:32 UTC
The main reason we don't check for libmtp-* symlinks is that we'd like to be able to support new MTP devices that libmtp doesn't know about.  If that causes too many false positives then we'll have to reconsider that.  If this happens for all PTP cameras, I think that's too many.

(In reply to comment #4)
> Created an attachment (id=158721) [details] [review]
> Ignore PTP cameras
> 
> I tested this patch with my Canon PowerShot SX200 (which previously appeared
> and is now igored) and with my Samsung U5, which is a proper MTP music player.

Will this work if the device is already mounted by gvfs?

I don't like the idea of opening the device on the main thread.  Depending on the device state, it can take multiple seconds.  If this check is necessary, maybe we could move it to mtp_device_open_cb in rb-mtp-source.c and make the mtp source invisible until the device has been opened.  That way the user doesn't see anything if we decide to ignore the device and we don't open the device twice.
Comment 8 Jonathan Matthew 2010-04-14 20:56:59 UTC
Comment on attachment 158722 [details] [review]
fix memory leak

pushed as commit e776656
Comment 9 Jonathan Matthew 2010-05-19 10:21:47 UTC
I've implemented half of what I proposed in comment 7 and pushed it as commit 4874bac.  What remains is to hide the device until we open it successfully, which requires some changes to the way the source list expands groups.  It currently doesn't expand a group when the number of visible sources within changes from 0 to 1, which isn't what we want here.
Comment 10 Jonathan Matthew 2010-12-30 20:48:42 UTC
*** Bug 638361 has been marked as a duplicate of this bug. ***
Comment 11 Jonathan Matthew 2011-02-26 01:54:25 UTC
We now only attempt to open devices that appear in libmtp's supported device list.  If required, we could add a way to indicate that a specific device should be used.
Comment 12 Martin Pitt 2011-02-28 09:29:01 UTC
Indeed, thanks! This now works for me, so from my POV this can be closed.
Comment 13 Colin Law 2013-01-25 21:15:10 UTC
Has this been fixed?  The status is still New.  If so can anyone indicate which version it was fixed in?
Comment 14 GNOME Infrastructure Team 2018-05-24 15:11:24 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/911.