+ self.showHint()
+
+ def showHint(self, ret=None):
+ self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and make sure the bootable USB stick is plugged in.\n2) Turn mains back on and hold the DOWN button on the front panel pressed for 10 seconds.\n3) Wait for bootup and follow instructions of the wizard."), type = MessageBox.TYPE_INFO)
+ self.umountCallback = self.keyRed
+ self.umount()
+
+ def getFeed(self):
+ self.feedDownloader15 = feedDownloader(self.feed_base, self.box, OE_vers="1.5")
+ self.feedDownloader16 = feedDownloader(self.feed_base, self.box, OE_vers="1.6")
+ self.feedlists = [[],[],[]]
+ self.feedDownloader15.getList(self.gotFeed, self.feed_failed)
+ self.feedDownloader16.getList(self.gotFeed, self.feed_failed)
+
+ def feed_failed(self, message=""):
+ self["status"].text = _("Could not connect to Dreambox .NFI Image Feed Server:") + "\n" + str(message) + "\n" + _("Please check your network settings!")
+
+ def gotFeed(self, feedlist, OE_vers):
+ print "[gotFeed]", OE_vers
+ releaselist = []
+ experimentallist = []
+
+ for name, url in feedlist:
+ if name.find("release") > -1:
+ releaselist.append((name, url))
+ if name.find("experimental") > -1:
+ experimentallist.append((name, url))
+ self.feedlists[ALLIMAGES].append((name, url))
+
+ if OE_vers == "1.6":
+ self.feedlists[RELEASE] = releaselist + self.feedlists[RELEASE]
+ self.feedlists[EXPERIMENTAL] = experimentallist + self.feedlists[RELEASE]
+ elif OE_vers == "1.5":
+ self.feedlists[RELEASE] = self.feedlists[RELEASE] + releaselist
+ self.feedlists[EXPERIMENTAL] = self.feedlists[EXPERIMENTAL] + experimentallist
+
+ self.setMenu()
+
+ def checkUSBStick(self):
+ self.target_dir = None
+ allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
+ print "[checkUSBStick] found partitions:", allpartitions
+ usbpartition = []
+ for x in allpartitions:
+ print x, x[1] == '/', x[0].find("USB"), access(x[1], R_OK)
+ if x[1] != '/' and x[0].find("USB") > -1: # and access(x[1], R_OK) is True:
+ usbpartition.append(x)
+
+ print usbpartition
+ if len(usbpartition) == 1:
+ self.target_dir = usbpartition[0][1]
+ self.md5_passback = self.getFeed
+ self.md5_failback = self.askStartWizard
+ self.md5verify(self.stickimage_md5, self.target_dir)
+ elif usbpartition == []:
+ print "[NFIFlash] needs to create usb flasher stick first!"
+ self.askStartWizard()
+ else:
+ self.askStartWizard()
+
+ def askStartWizard(self):
+ self.branch = STICK_WIZARD
+ message = _("""This plugin creates a USB stick which can be used to update the firmware of your Dreambox without the need for a network or WLAN connection.
+First, a USB stick needs to be prepared so that it becomes bootable.
+In the next step, an NFI image file can be downloaded from the update server and saved on the USB stick.
+If you already have a prepared bootable USB stick, please insert it now. Otherwise plug in a USB stick with a minimum size of 64 MB!""")
+ self.session.openWithCallback(self.wizardDeviceBrowserClosed, DeviceBrowser, None, message, showDirectories=True, showMountpoints=True, inhibitMounts=["/","/autofs/sr0/","/autofs/sda1/","/media/hdd/","/media/net/",self.usbmountpoint,"/media/dvd/"])
+
+ def wizardDeviceBrowserClosed(self, path):
+ print "[wizardDeviceBrowserClosed]", path
+ self.target_dir = path
+ if path:
+ self.md5_passback = self.getFeed
+ self.md5_failback = self.wizardQuery
+ self.md5verify(self.stickimage_md5, self.target_dir)