=== modified file 'plugins/massstorage/__init__.py' --- plugins/massstorage/__init__.py 2010-06-15 17:39:14 +0000 +++ plugins/massstorage/__init__.py 2010-07-07 22:42:27 +0000 @@ -104,6 +104,8 @@ except dbus.exceptions.DBusException,e: if not e.get_dbus_name() == "org.freedesktop.Hal.NoSuchProperty": common.log_exception(log=logger) + if "volume" in capabilities: + return 11 return 0 def get_udis(self, hal): @@ -117,22 +119,43 @@ "storage" in device.GetProperty( "portable_audio_player.access_method.protocols"): ret.append(udi) + + # look for volumes with .is_audio_player in root + udis = hal.hal.FindDeviceByCapability("volume") + for udi in udis: + dev_obj = hal.bus.get_object("org.freedesktop.Hal", udi) + device = dbus.Interface(dev_obj, "org.freedesktop.Hal.Device") + try: + os.stat(device.GetProperty("volume.mount_point")+"/.is_audio_player") + ret.append(udi) + except OSError: + pass + return ret def device_from_udi(self, hal, udi): mass_obj = hal.bus.get_object("org.freedesktop.Hal", udi) mass = dbus.Interface(mass_obj, "org.freedesktop.Hal.Device") - if "storage" not in mass.GetProperty( - "portable_audio_player.access_method.protocols"): - return - - - u = mass.GetProperty("portable_audio_player.storage_device") - mountpoints = [HalMountpoint(hal, u)] - - name = mass.GetProperty("info.vendor") + " " + \ - mass.GetProperty("info.product") - massdev = MassStorageDevice(mountpoints, name) + try: + props = mass.GetProperty("portable_audio_player.access_method.protocols") + if "storage" in props: + + u = mass.GetProperty("portable_audio_player.storage_device") + mountpoints = [HalMountpoint(hal, u)] + + name = mass.GetProperty("info.vendor") + " " + \ + mass.GetProperty("info.product") + return MassStorageDevice(mountpoints, name) + except: + pass + + try: + os.stat(mass.GetProperty("volume.mount_point")+"/.is_audio_player") + name = mass.GetProperty("info.product") + # TODO: parse .is_audio_player for actual dirs with music + return MassStorageDevice([mass.GetProperty("volume.mount_point")], name) + except OSError: + pass return massdev