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 629323 - GIO backend is detecting regular mass storage devices as media devices
GIO backend is detecting regular mass storage devices as media devices
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: Device - USB Mass Storage
git master
Other Linux
: Normal critical
: 1.8
Assigned To: Banshee Maintainers
Banshee Maintainers
: 630816 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-10 21:32 UTC by Jensen Somers
Modified: 2010-09-28 15:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
USB drive detected as media devie. (8.31 KB, image/png)
2010-09-10 21:32 UTC, Jensen Somers
Details
udevadm info --export-db (122.39 KB, text/plain)
2010-09-10 21:36 UTC, Jensen Somers
Details

Description Jensen Somers 2010-09-10 21:32:19 UTC
Created attachment 169992 [details]
USB drive detected as media devie.

I switched to using the GIO back-end instead of HAL a couple of days ago and I noticed that Banshee is listing my external hard drives as media players. There is no media_player file on them nor are they actual media devices. There is video on the drive and Banshee is actually correctly detecting that, but that's not the wanted behavior.
Comment 1 Jensen Somers 2010-09-10 21:34:40 UTC
gvfs-mount --list output for the drive in question:

Drive(6): 1.5 TB Hard Disk
  Type: GProxyDrive (GProxyVolumeMonitorGdu)
  Volume(0): Samsung Extern 2
    Type: GProxyVolume (GProxyVolumeMonitorGdu)
    Mount(0): Samsung Extern 2 -> file:///media/Samsung%20Extern%202
      Type: GProxyMount (GProxyVolumeMonitorGdu)
Comment 2 Jensen Somers 2010-09-10 21:36:30 UTC
Created attachment 169993 [details]
udevadm info --export-db
Comment 3 Jensen Somers 2010-09-12 18:11:44 UTC
I think this issue also affects folders that are mounted using the --bind option. My / is very small and my /home/jensen/Music folder was mounted to a folder on my /media/data drive. When I started Banshee I always got an exception in the debug log. I recently switched from the mount to using a soft link to the folder on my data drive and the exception disappeared.
Comment 4 Gabriel Burt 2010-09-22 17:44:35 UTC
This is a really big bug that needs to be fixed before 1.8.0
Comment 5 Jensen Somers 2010-09-25 09:12:31 UTC
I quickly looked at the code inside the MassStorageSource class and I found the following.

On line 71 (in my current git copy at least) there's an if statement:

if (ms_device.ShouldIgnoreDevice () || !ms_device.LoadDeviceConfiguration ()) {
  ms_device = null;
}

In my case for my external hard drives the LoadDeviceConfiguration() call returns false, so the ms_device is set to null.

Below that, on line 78 there's another check:

if (!HasMediaCapabilities && ms_device == null) {
  throw new InvalidDeviceException ();
}

My device actually has media capabilities so this won't throw. Further down it doesn't matter whether ms_device was null, the Initialize() call on line 98 is always done which eventually results in my external hard drives showing up in Banshee.

I can quickly work around this by modifying the code on line 78 to an OR check:

if (!HasMediaCapabilities || ms_device == null) {
  throw new InvalidDeviceException ();
}

Now Banshee doesn't load my external hard drives anymore, but it still loads my iPod and HTC phone, so that's good.

However, I am mostly unfamiliar with the code and the way it should actually behave so I did not include a patch just yet.
Comment 6 Alan McGovern 2010-09-25 11:46:50 UTC
I just fixed this in git master with f7f4bfb6. We were creating a DeviceMediaCapabilities object even if IdMediaPlayer was null.
Comment 7 Gabriel Burt 2010-09-28 15:09:45 UTC
*** Bug 630816 has been marked as a duplicate of this bug. ***