From f6eb057a649af473af96b368e5f93c955c167a95 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Thu, 19 Jul 2007 20:38:24 +0000 Subject: [PATCH] Improved the volume detection code --- tools/pamusb-conf | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tools/pamusb-conf b/tools/pamusb-conf index 60422d1..1145ee6 100755 --- a/tools/pamusb-conf +++ b/tools/pamusb-conf @@ -24,7 +24,6 @@ from xml.dom import minidom class Device: def __init__(self, udi): self.__udi = udi - self.__findStorageDevice() deviceObj = bus.get_object('org.freedesktop.Hal', udi) deviceProperties = deviceObj.GetAllProperties( @@ -47,13 +46,6 @@ class Device: return True return self.__isChildOfDevice(properties['info.parent']) - def __findStorageDevice(self): - for child in halManager.FindDeviceByCapability('storage'): - if self.__isChildOfDevice(child): - self.__storageUdi = child - return - raise Exception, '%s is not a storage device.' % self.__udi - def __repr__(self): return "%s %s (%s)" % (self.vendor, self.product, self.serialNumber) @@ -64,7 +56,9 @@ class Device: volume) deviceProperties = deviceObj.GetAllProperties( dbus_interface = 'org.freedesktop.Hal.Device') - if deviceProperties['block.storage_device'] != self.__storageUdi: + if deviceProperties['block.major'] != 8: + continue + if not self.__isChildOfDevice(volume): continue vols.append({'uuid' : deviceProperties['volume.uuid'], 'device' : deviceProperties['block.device']})