- self.session.openWithCallback(self.stick_back_in, MessageBox, (_("Now please insert the USB stick (minimum size is 64 MB) that you want to format and use as .NFI image flasher. Press OK after you've put the stick back in.")), MessageBox.TYPE_INFO)
-
- def stick_back_in(self, answer):
- self["statusbar"].text = _("Waiting for USB stick to settle...")
- self.delayTimer = eTimer()
- self.delayTimer.callback.append(self.waiting_for_stick)
- self.delayCount = -1
- self.delayTimer.start(1000)
-
- def waiting_for_stick(self):
- self.delayCount += 1
- self["job_progressbar"].range = 6
- self["job_progressbar"].value = self.delayCount
- self["job_progresslabel"].text = "-%d s" % (6-self.delayCount)
- if self.delayCount > 5:
- self.delayTimer.stop()
+ self.msgbox = self.session.open(MessageBox, _("Please disconnect all USB devices from your Dreambox and (re-)attach the target USB stick (minimum size is 64 MB) now!"), MessageBox.TYPE_INFO)
+ hotplugNotifier.append(self.hotplugCB)
+
+ def hotplugCB(self, dev, action):
+ print "[hotplugCB]", dev, action
+ if dev.startswith("sd") and action == "add":
+ self.msgbox.close()
+ hotplugNotifier.remove(self.hotplugCB)