stop idle timer when removing a harddisk
[enigma2.git] / lib / python / Components / Harddisk.py
index 44245ebb8b16847426cc0a83a276e459da908988..470055e4f2bbb2394b1e8f4eccfb7078d70ee32c 100644 (file)
@@ -21,6 +21,7 @@ class Harddisk:
                s_minor = int(tmp[1])
                self.max_idle_time = 0
                self.idle_running = False
+               self.timer = None
                for disc in listdir("/dev/discs"):
                        path = readlink('/dev/discs/'+disc)
                        devidex = '/dev/discs/'+disc+'/'
@@ -37,6 +38,11 @@ class Harddisk:
        def __lt__(self, ob):
                return self.device < ob.device
 
+       def stop(self):
+               if self.timer:
+                       self.timer.stop()
+                       self.timer.callback.remove(self.runIdle)
+
        def bus(self):
                ide_cf = self.device.find("hd") == 0 and self.devidex2.find("host0") == -1 # 7025 specific
                internal = self.device.find("hd") == 0
@@ -454,6 +460,7 @@ class HarddiskManager:
                        idx = 0
                        for hdd in self.hdd:
                                if hdd.device == device:
+                                       self.hdd[x].stop()
                                        del self.hdd[idx]
                                        break
                        SystemInfo["Harddisk"] = len(self.hdd) > 0