GNOME Bugzilla – Bug 629323
GIO backend is detecting regular mass storage devices as media devices
Last modified: 2010-09-28 15:09:45 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.
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)
Created attachment 169993 [details] udevadm info --export-db
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.
This is a really big bug that needs to be fixed before 1.8.0
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.
I just fixed this in git master with f7f4bfb6. We were creating a DeviceMediaCapabilities object even if IdMediaPlayer was null.
*** Bug 630816 has been marked as a duplicate of this bug. ***