follow hotplug-ng changes
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 28 Feb 2008 21:46:21 +0000 (21:46 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 28 Feb 2008 21:46:21 +0000 (21:46 +0000)
lib/python/Plugins/SystemPlugins/Hotplug/plugin.py

index 882668f74c6dcd9e84925f07abba4d6665763836..89e536bab79c0123721b1857d717df1cb11122cc 100644 (file)
@@ -21,18 +21,24 @@ class Hotplug(Protocol):
        def connectionLost(self, reason):
                data = self.received.split('\0')[:-1]
 
-               print "hotplug:", data
+               v = {}
 
-               if len(data) < 4:
-                       return
+               for x in data:
+                       i = x.find('=')
+                       var, val = x[:i], x[i+1:]
+                       v[var] = val
 
-               (action, device, physdev, driver) = data[:4]
+               print "hotplug:", v
+
+               action = v.get("ACTION")
+               device = v.get("DEVPATH")
+               physdevpath = v.get("PHYSDEVPATH")
 
                dev = device.split('/')[-1]
 
                if action == "add":
                        print "Medium found in", self.getUserfriendlyDeviceName(dev)
-                       harddiskmanager.addHotplugPartition(dev, self.getUserfriendlyDeviceName(dev))
+                       harddiskmanager.addHotplugPartition(dev, self.getUserfriendlyDeviceName(physdevpath))
                elif action == "remove":
                        harddiskmanager.removeHotplugPartition(dev)