aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Plugins')
-rwxr-xr-xlib/python/Plugins/DemoPlugins/Makefile.am6
-rw-r--r--lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am5
-rw-r--r--lib/python/Plugins/DemoPlugins/TPMDemo/README1
-rw-r--r--lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py0
-rw-r--r--lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py87
-rwxr-xr-xlib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml13
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/DVDProject.py9
-rwxr-xr-xlib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py4
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/DreamboxDVD.ddvdp.xml6
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/Process.py14
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/Text_menu_boat.ddvdm.xml10
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/Thumbs_menu_clouds.ddvdm.xml10
-rw-r--r--lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py4
-rwxr-xr-xlib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml17
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/Makefile.am2
-rwxr-xr-xlib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml13
-rwxr-xr-xlib/python/Plugins/Extensions/DVDPlayer/plugin.py36
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am25
-rw-r--r--lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp5
-rwxr-xr-xlib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml15
-rwxr-xr-xlib/python/Plugins/Extensions/Makefile.am6
-rwxr-xr-xlib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml13
-rwxr-xr-xlib/python/Plugins/Extensions/MediaPlayer/plugin.py21
-rwxr-xr-xlib/python/Plugins/Extensions/MediaPlayer/settings.py2
-rwxr-xr-xlib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml14
-rwxr-xr-xlib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml13
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml11
-rw-r--r--lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am24
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml11
-rw-r--r--lib/python/Plugins/Makefile.am1
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml18
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml23
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py6
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py40
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml17
-rwxr-xr-xlib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py38
-rwxr-xr-xlib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml16
-rwxr-xr-xlib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml16
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml14
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml15
-rw-r--r--lib/python/Plugins/SystemPlugins/Hotplug/plugin.py326
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenandbin71669 -> 0 bytes
-rw-r--r--lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py1282
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py346
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml18
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NFIFlash/mywritenandbin71626 -> 0 bytes
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NFIFlash/plugin.py23
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml16
-rwxr-xr-xlib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml17
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml16
-rwxr-xr-xlib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml18
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml15
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SkinSelector/plugin.py3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py14
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py215
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml18
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py506
-rwxr-xr-xlib/python/Plugins/SystemPlugins/TempFanControl/LICENSE12
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am6
-rwxr-xr-xlib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am3
-rwxr-xr-xlib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml20
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py1
-rwxr-xr-xlib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml16
-rwxr-xr-xlib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml13
-rw-r--r--lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py4
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py18
-rwxr-xr-xlib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml14
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am2
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py179
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/flags.py104
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py1114
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml12
-rwxr-xr-xlib/python/Plugins/SystemPlugins/WirelessLan/plugin.py76
-rwxr-xr-x[-rw-r--r--]lib/python/Plugins/newplugin.py2
76 files changed, 2320 insertions, 2716 deletions
diff --git a/lib/python/Plugins/DemoPlugins/Makefile.am b/lib/python/Plugins/DemoPlugins/Makefile.am
index aace17cc..9e16bfc1 100755
--- a/lib/python/Plugins/DemoPlugins/Makefile.am
+++ b/lib/python/Plugins/DemoPlugins/Makefile.am
@@ -1,6 +1,8 @@
installdir = $(pkglibdir)/python/Plugins/DemoPlugins
-SUBDIRS = TestPlugin
+SUBDIRS = TestPlugin TPMDemo
install_PYTHON = \
- __init__.py \ No newline at end of file
+ __init__.py
+
+ \ No newline at end of file
diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am
new file mode 100644
index 00000000..4828081f
--- /dev/null
+++ b/lib/python/Plugins/DemoPlugins/TPMDemo/Makefile.am
@@ -0,0 +1,5 @@
+installdir = $(pkglibdir)/python/Plugins/DemoPlugins/TPMDemo
+
+install_PYTHON = \
+ __init__.py \
+ plugin.py
diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/README b/lib/python/Plugins/DemoPlugins/TPMDemo/README
new file mode 100644
index 00000000..89a972aa
--- /dev/null
+++ b/lib/python/Plugins/DemoPlugins/TPMDemo/README
@@ -0,0 +1 @@
+Please read enigma2/doc/TPM for further instructions on how to integrate this into your own plugins. \ No newline at end of file
diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py b/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/lib/python/Plugins/DemoPlugins/TPMDemo/__init__.py
diff --git a/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py
new file mode 100644
index 00000000..2c078d35
--- /dev/null
+++ b/lib/python/Plugins/DemoPlugins/TPMDemo/plugin.py
@@ -0,0 +1,87 @@
+from Screens.Screen import Screen
+from Plugins.Plugin import PluginDescriptor
+from enigma import eTPM
+import sha
+
+def bin2long(s):
+ return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+ res = ""
+ for byte in range(128):
+ res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+ return res
+
+def rsa_pub1024(src, mod):
+ return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+
+def decrypt_block(src, mod):
+ if len(src) != 128 and len(src) != 202:
+ return None
+ dest = rsa_pub1024(src[:128], mod)
+ hash = sha.new(dest[1:107])
+ if len(src) == 202:
+ hash.update(src[131:192])
+ result = hash.digest()
+ if result == dest[107:127]:
+ return dest
+ return None
+
+def validate_cert(cert, key):
+ buf = decrypt_block(cert[8:], key)
+ if buf is None:
+ return None
+ return buf[36:107] + cert[139:196]
+
+def read_random():
+ try:
+ fd = open("/dev/urandom", "r")
+ buf = fd.read(8)
+ fd.close()
+ return buf
+ except:
+ return None
+
+def main(session, **kwargs):
+ try:
+ device = open("/proc/stb/info/model", "r").readline().strip()
+ except:
+ device = ""
+ if device != "dm7025":
+ rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+
+ etpm = eTPM()
+ l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+ if l2cert is None:
+ print "l2cert not found"
+ return
+
+ l2key = validate_cert(l2cert, rootkey)
+ if l2key is None:
+ print "l2cert invalid"
+ return
+
+ l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+ if l3cert is None:
+ print "l3cert not found (can be fixed by running the genuine dreambox plugin and running the offered update)"
+ return
+
+ l3key = validate_cert(l3cert, l2key)
+ if l3key is None:
+ print "l3cert invalid"
+ return
+
+ rnd = read_random()
+ if rnd is None:
+ print "random error"
+ return
+ val = etpm.challenge(rnd)
+ result = decrypt_block(val, l3key)
+ if device == "dm7025" or result[80:88] == rnd:
+ print "successfully finished the tpm test"
+ # would start your plugin here
+
+def Plugins(**kwargs):
+ return [PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main),
+ PluginDescriptor(name = "TPM Demo", description = _("A demo plugin for TPM usage."), icon = "plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main)]
+ \ No newline at end of file
diff --git a/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml b/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml
index 1431caf4..7132ba02 100755
--- a/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml
+++ b/lib/python/Plugins/Extensions/CutListEditor/meta/plugin_cutlisteditor.xml
@@ -2,23 +2,14 @@
<prerequisites>
<tag type="Recording" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>CutListEditor</name>
<packagename>enigma2-plugin-extensions-cutlisteditor</packagename>
- <shortdescription>CutListEditor allows you to edit your movies.</shortdescription>
+ <shortdescription>CutListEditor allows you to edit your movies</shortdescription>
<description>CutListEditor allows you to edit your movies.\nSeek to the start of the stuff you want to cut away. Press OK, select 'start cut'.\nThen seek to the end, press OK, select 'end cut'. That's it.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_cutlisteditor.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>Schnitteditor</name>
- <packagename>enigma2-plugin-extensions-cutlisteditor</packagename>
- <shortdescription>Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden.</shortdescription>
- <description>Mit dem Schnitteditor können Sie Ihre Aufnahmen schneiden.\nSpulen Sie zum Anfang des zu schneidenden Teils der Aufnahme. Drücken Sie dann OK und wählen Sie: 'start cut'.\nDann spulen Sie zum Ende, drücken OK und wählen 'end cut'. Das ist alles.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_cutlisteditor.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-cutlisteditor" />
</files>
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
index 7f755db4..6dbcd499 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/DVDProject.py
@@ -2,6 +2,7 @@ from Tools.Directories import fileExists
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigSubList
import DVDTitle
import xml.dom.minidom
+from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_FONTS
class ConfigColor(ConfigSequence):
def __init__(self, default = [128,128,128]):
@@ -125,6 +126,14 @@ class DVDProject:
for key in self.filekeys:
val = self.settings.dict()[key].getValue()
if not fileExists(val):
+ if val[0] != "/":
+ if key.find("font") == 0:
+ val = resolveFilename(SCOPE_FONTS)+val
+ else:
+ val = resolveFilename(SCOPE_PLUGINS)+"Extensions/DVDBurn/"+val
+ if fileExists(val):
+ self.settings.dict()[key].setValue(val)
+ continue
self.error += "\n%s '%s' not found" % (key, val)
#except AttributeError:
#print "loadProject AttributeError", self.error
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
index 53287a36..0b81cfdf 100755
--- a/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/DVDToolbox.py
@@ -68,7 +68,7 @@ class DVDToolbox(Screen):
self["info"].text = ""
self["details"].setText("")
self.Console = Console()
- cmd = "/bin/dvd+rw-mediainfo /dev/" + harddiskmanager.getCD()
+ cmd = "dvd+rw-mediainfo /dev/" + harddiskmanager.getCD()
self.Console.ePopen(cmd, self.mediainfoCB)
def format(self):
@@ -186,7 +186,7 @@ class DVDformatTask(Task):
Task.__init__(self, job, ("RW medium format"))
self.toolbox = job.toolbox
self.postconditions.append(DVDformatTaskPostcondition())
- self.setTool("/bin/dvd+rw-format")
+ self.setTool("dvd+rw-format")
self.args += [ "/dev/" + harddiskmanager.getCD() ]
self.end = 1100
self.retryargs = [ ]
diff --git a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVD.ddvdp.xml b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVD.ddvdp.xml
index 451e8a8b..4645260d 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVD.ddvdp.xml
+++ b/lib/python/Plugins/Extensions/DVDBurn/DreamboxDVD.ddvdp.xml
@@ -3,11 +3,11 @@
<settings
name="Dreambox DVD record"
authormode="menu_linked"
- menutemplate="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/Thumbs_menu_clouds.ddvdm.xml"
+ menutemplate="Thumbs_menu_clouds.ddvdm.xml"
titlesetmode="multi"
- vmgm="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/vmgmdream.mpg"
+ vmgm="vmgmdream.mpg"
output="dvd"
- isopath="/media/hdd/movie/"
+ isopath="/hdd/movie/"
dataformat="iso9660_4"
/>
<titles> </titles>
diff --git a/lib/python/Plugins/Extensions/DVDBurn/Process.py b/lib/python/Plugins/Extensions/DVDBurn/Process.py
index b64541b6..e00dedd9 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/Process.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/Process.py
@@ -95,6 +95,8 @@ class DemuxTask(Task):
self.relevantAudioPIDs = [ ]
self.getRelevantAudioPIDs(title)
self.generated_files = [ ]
+ self.mplex_audiofiles = { }
+ self.mplex_videofile = ""
self.mplex_streamfiles = [ ]
if len(self.cutlist) > 1:
self.args += [ "-cut", self.cutfile ]
@@ -132,8 +134,10 @@ class DemuxTask(Task):
def haveNewFile(self, file):
print "[DemuxTask] produced file:", file, self.currentPID
self.generated_files.append(file)
- if self.currentPID in self.relevantAudioPIDs or file.endswith("m2v"):
- self.mplex_streamfiles.append(file)
+ if self.currentPID in self.relevantAudioPIDs:
+ self.mplex_audiofiles[self.currentPID] = file
+ elif file.endswith("m2v"):
+ self.mplex_videofile = file
def haveProgress(self, progress):
#print "PROGRESS [%s]" % progress
@@ -167,6 +171,12 @@ class DemuxTask(Task):
f.close()
def cleanup(self, failed):
+ print "[DemuxTask::cleanup]"
+ self.mplex_streamfiles = [ self.mplex_videofile ]
+ for pid in self.relevantAudioPIDs:
+ self.mplex_streamfiles.append(self.mplex_audiofiles[pid])
+ print self.mplex_streamfiles
+
if failed:
import os
for file in self.generated_files:
diff --git a/lib/python/Plugins/Extensions/DVDBurn/Text_menu_boat.ddvdm.xml b/lib/python/Plugins/Extensions/DVDBurn/Text_menu_boat.ddvdm.xml
index 0de7f4b6..bf6356a9 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/Text_menu_boat.ddvdm.xml
+++ b/lib/python/Plugins/Extensions/DVDBurn/Text_menu_boat.ddvdm.xml
@@ -3,17 +3,17 @@
<settings
titleformat="$i. $t"
subtitleformat="$D.$M.$Y, $T $C, $d"
- menubg="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/dreamdvd_boat.jpg"
- menuaudio="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/silence.mp2"
+ menubg="dreamdvd_boat.jpg"
+ menuaudio="silence.mp2"
dimensions="(720, 576)"
rows="5"
cols="1"
color_button="[8, 0, 0]"
color_highlight="[0, 192, 192]"
color_headline="[0, 0, 128]"
- fontface_headline="/usr/share/fonts/nmsbd.ttf"
- fontface_title="/usr/share/fonts/nmsbd.ttf"
- fontface_subtitle="/usr/share/fonts/nmsbd.ttf"
+ fontface_headline="nmsbd.ttf"
+ fontface_title="nmsbd.ttf"
+ fontface_subtitle="nmsbd.ttf"
fontsize_headline="46"
fontsize_title="24"
fontsize_subtitle="14"
diff --git a/lib/python/Plugins/Extensions/DVDBurn/Thumbs_menu_clouds.ddvdm.xml b/lib/python/Plugins/Extensions/DVDBurn/Thumbs_menu_clouds.ddvdm.xml
index c00c3fee..074f2037 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/Thumbs_menu_clouds.ddvdm.xml
+++ b/lib/python/Plugins/Extensions/DVDBurn/Thumbs_menu_clouds.ddvdm.xml
@@ -3,17 +3,17 @@
<settings
titleformat="$t"
subtitleformat="$d"
- menubg="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/dreamdvd_clouds.jpg"
- menuaudio="/usr/lib/enigma2/python/Plugins/Extensions/DVDBurn/silence.mp2"
+ menubg="dreamdvd_clouds.jpg"
+ menuaudio="silence.mp2"
dimensions="(720, 576)"
rows="2"
cols="2"
color_button="[8, 0, 0]"
color_highlight="[128, 0, 0]"
color_headline="[128, 0, 0]"
- fontface_headline="/usr/share/fonts/nmsbd.ttf"
- fontface_title="/usr/share/fonts/nmsbd.ttf"
- fontface_subtitle="/usr/share/fonts/nmsbd.ttf"
+ fontface_headline="nmsbd.ttf"
+ fontface_title="nmsbd.ttf"
+ fontface_subtitle="nmsbd.ttf"
fontsize_headline="46"
fontsize_title="18"
fontsize_subtitle="12"
diff --git a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py
index a52fad9f..71a7f239 100644
--- a/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py
+++ b/lib/python/Plugins/Extensions/DVDBurn/TitleCutter.py
@@ -32,9 +32,9 @@ class TitleCutter(CutListEditor):
pid = str(i.getPID())
if description == "MPEG":
description = "MP2"
- print "[audiotrack] pid:", pid, "description:", description, "language:", DVB_lang
+ print "[audiotrack] pid:", pid, "description:", description, "language:", DVB_lang, "count:", x, "active:", (x < 8)
self.t.properties.audiotracks.append(ConfigSubsection())
- self.t.properties.audiotracks[-1].active = ConfigYesNo(default = True)
+ self.t.properties.audiotracks[-1].active = ConfigYesNo(default = (x < 8))
self.t.properties.audiotracks[-1].format = ConfigFixedText(description)
self.t.properties.audiotracks[-1].language = ConfigSelection(choices = languageChoices.choices, default=languageChoices.getLanguage(DVB_lang))
self.t.properties.audiotracks[-1].pid = ConfigFixedText(pid)
diff --git a/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml b/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml
index 647d1cfd..c1e202a9 100755
--- a/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml
+++ b/lib/python/Plugins/Extensions/DVDBurn/meta/plugin_dvdburn.xml
@@ -3,22 +3,17 @@
<tag type="Recording" />
<tag type="Software" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>DVDBurn</name>
<packagename>enigma2-plugin-extensions-dvdburn</packagename>
- <shortdescription>With DVDBurn you can burn your recordings to a dvd.</shortdescription>
- <description>With DVDBurn you can burn your recordings to a dvd.\nArchive all your favorite movies to recordable dvds with menus if wanted.</description>
+ <shortdescription>Burn your recordings to DVD</shortdescription>
+ <description>With DVDBurn you can make compilations of records from your Dreambox hard drive.\n
+ Optionally you can add customizable menus. You can record the compilation to a standard-compliant DVD that can be played on conventinal DVD players.\n
+ HDTV recordings can only be burned in proprietary dreambox format.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdburn_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>DVDBurn</name>
- <packagename>enigma2-plugin-extensions-dvdburn</packagename>
- <shortdescription>Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD.</shortdescription>
- <description>Mit DVDBurn brennen Sie ihre Aufnahmen auf DVD.\nArchivieren Sie Ihre Liblingsfilme auf DVD mit Menus wenn Sie es wünschen.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdburn_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-dvdburn" />
</files>
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am
index 71ea7142..ec212e47 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am
+++ b/lib/python/Plugins/Extensions/DVDPlayer/Makefile.am
@@ -1,4 +1,3 @@
-if HAVE_DDVDLIB
SUBDIRS = src meta
installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer
@@ -8,4 +7,3 @@ install_PYTHON = \
plugin.py \
keymap.xml \
LICENSE
-endif
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml b/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml
index 1353f7d2..6fc5a6f1 100755
--- a/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml
+++ b/lib/python/Plugins/Extensions/DVDPlayer/meta/plugin_dvdplayer.xml
@@ -2,23 +2,14 @@
<prerequisites>
<tag type="Multimedia" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>DVDPlayer</name>
<packagename>enigma2-plugin-extensions-dvdplayer</packagename>
- <shortdescription>DVDPlayer plays your DVDs on your Dreambox.</shortdescription>
+ <shortdescription>DVDPlayer plays your DVDs on your Dreambox</shortdescription>
<description>DVDPlayer plays your DVDs on your Dreambox.\nWith the DVDPlayer you can play your DVDs on your Dreambox from a DVD or even from an iso file or video_ts folder on your harddisc or network.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdplayer.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>DVDPlayer</name>
- <packagename>enigma2-plugin-extensions-dvdplayer</packagename>
- <shortdescription>Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab.</shortdescription>
- <description>Spielen Sie Ihre DVDs mit dem DVDPlayer auf Ihrer Dreambox ab.\nMit dem DVDPlayer können Sie Ihre DVDs auf Ihrer Dreambox abspielen. Dabei ist es egal ob Sie von DVD, iso-Datei oder sogar direkt von einer video_ts Ordnerstruktur von Ihrer Festplatte oder dem Netzwerk abspielen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_dvdplayer.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-dvdplayer" />
</files>
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
index 3d262c92..ddfe1989 100755
--- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py
@@ -39,7 +39,10 @@ class FileBrowser(Screen):
currDir = "/media/dvd/"
if not pathExists(currDir):
currDir = "/"
+ if lastpath == "": # 'None' is magic to start at the list of mountpoints
+ currDir = None
+ inhibitDirs = ["/bin", "/boot", "/dev", "/etc", "/home", "/lib", "/proc", "/sbin", "/share", "/sys", "/tmp", "/usr", "/var"]
self.filelist = FileList(currDir, matchingPattern = "(?i)^.*\.(iso)", useServiceRef = True)
self["filelist"] = self.filelist
@@ -79,6 +82,12 @@ class FileBrowser(Screen):
lastpath = (pathname.rstrip("/").rsplit("/",1))[0]
print "lastpath video_ts.ifo=", lastpath
self.close(pathname)
+ if fileExists(pathname+"VIDEO_TS/VIDEO_TS.IFO"):
+ print "dvd structure found, trying to open..."
+ lastpath = (pathname.rstrip("/").rsplit("/",1))[0]
+ print "lastpath video_ts.ifo=", lastpath
+ pathname += "VIDEO_TS"
+ self.close(pathname)
else:
lastpath = filename[0:filename.rfind("/")]
print "lastpath directory=", lastpath
@@ -88,8 +97,8 @@ class FileBrowser(Screen):
self.close(None)
class DVDSummary(Screen):
- skin = """
- <screen position="0,0" size="132,64">
+ skin = (
+ """<screen name="DVDSummary" position="0,0" size="132,64" id="1">
<widget source="session.CurrentService" render="Label" position="5,4" size="120,28" font="Regular;12" transparent="1" >
<convert type="ServiceName">Name</convert>
</widget>
@@ -101,7 +110,20 @@ class DVDSummary(Screen):
<widget source="session.CurrentService" render="Progress" position="6,46" size="60,18" borderWidth="1" >
<convert type="ServicePosition">Position</convert>
</widget>
- </screen>"""
+ </screen>""",
+ """<screen name="DVDSummary" position="0,0" size="96,64" id="2">
+ <widget source="session.CurrentService" render="Label" position="0,0" size="96,25" font="Regular;12" transparent="1" >
+ <convert type="ServiceName">Name</convert>
+ </widget>
+ <widget name="DVDPlayer" position="0,26" size="96,12" font="Regular;10" transparent="1" />
+ <widget name="Chapter" position="0,40" size="66,12" font="Regular;10" transparent="1" halign="left" />
+ <widget source="session.CurrentService" render="Label" position="66,40" size="30,12" font="Regular;10" transparent="1" halign="right" >
+ <convert type="ServicePosition">Position</convert>
+ </widget>
+ <widget source="session.CurrentService" render="Progress" position="0,52" size="96,12" borderWidth="1" >
+ <convert type="ServicePosition">Position</convert>
+ </widget>
+ </screen>""")
def __init__(self, session, parent):
Screen.__init__(self, session, parent)
@@ -606,6 +628,14 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP
newref = eServiceReference(4369, 0, val)
print "play", newref.toString()
if curref is None or curref != newref:
+ if newref.toString().endswith("/VIDEO_TS") or newref.toString().endswith("/"):
+ names = newref.toString().rsplit("/",3)
+ if names[2].startswith("Disk ") or names[2].startswith("DVD "):
+ name = str(names[1]) + " - " + str(names[2])
+ else:
+ name = names[2]
+ print "setting name to: ", self.service
+ newref.setName(str(name))
self.session.nav.playService(newref)
self.service = self.session.nav.getCurrentService()
print "self.service", self.service
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
index 27c751cf..3e2ee67c 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
+++ b/lib/python/Plugins/Extensions/DVDPlayer/src/Makefile.am
@@ -1,17 +1,18 @@
-OBJS := servicedvd.cpp
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/include \
+ -include Python.h \
+ -include $(top_builddir)/enigma2_config.h
--include $(OBJS:.cpp=.d)
+AM_CXXFLAGS = @LIBDDVD_CFLAGS@
-installdir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer
+plugindir = $(pkglibdir)/python/Plugins/Extensions/DVDPlayer
-install_PYTHON = \
- servicedvd.so
+plugin_LTLIBRARIES = servicedvd.la
-servicedvd.so:
- $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \
- -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,servicedvd.so -o servicedvd.so \
- $(LDFLAGS) -ldreamdvd
+servicedvd_la_SOURCES = \
+ servicedvd.cpp \
+ servicedvd.h
-all: servicedvd.so
-
-CLEANFILES = servicedvd.so servicedvd.d
+servicedvd_la_LDFLAGS = -avoid-version -module
+servicedvd_la_LIBADD = @LIBDDVD_LIBS@
diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp
index 2ba53927..4ef00ab0 100644
--- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp
+++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp
@@ -480,7 +480,10 @@ RESULT eServiceDVD::getName(std::string &name)
if ( m_ddvd_titlestring[0] != '\0' )
name = m_ddvd_titlestring;
else
- name = m_ref.path;
+ if ( !m_ref.name.empty() )
+ name = m_ref.name;
+ else
+ name = m_ref.path;
return 0;
}
diff --git a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml
index a10840da..d3a2edf8 100755
--- a/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml
+++ b/lib/python/Plugins/Extensions/GraphMultiEPG/meta/plugin_graphmultiepg.xml
@@ -3,23 +3,14 @@
<tag type="EPG" />
<tag type="Recording" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>GraphMultiEPG</name>
- <packagename>eenigma2-plugin-extensions-graphmultiepg</packagename>
- <shortdescription>GraphMultiEPG shows a graphical timeline EPG.</shortdescription>
+ <packagename>enigma2-plugin-extensions-graphmultiepg</packagename>
+ <shortdescription>GraphMultiEPG shows a graphical timeline EPG</shortdescription>
<description>GraphMultiEPG shows a graphical timeline EPG.\nShows a nice overview of all running und upcoming tv shows.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_graphmultiepg_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>GraphMultiEPG</name>
- <packagename>enigma2-plugin-extensions-graphmultiepg</packagename>
- <shortdescription>Zeigt ein grafisches Zeitlinien-EPG.</shortdescription>
- <description>Zeigt ein grafisches Zeitlinien-EPG.\nZeigt eine grafische Übersicht aller laufenden und kommenden Sendungen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_graphmultiepg_de.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-graphmultiepg" />
</files>
diff --git a/lib/python/Plugins/Extensions/Makefile.am b/lib/python/Plugins/Extensions/Makefile.am
index 5a6e3f3a..7a3a9be2 100755
--- a/lib/python/Plugins/Extensions/Makefile.am
+++ b/lib/python/Plugins/Extensions/Makefile.am
@@ -1,6 +1,10 @@
installdir = $(pkglibdir)/python/Plugins/Extensions
-SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDPlayer DVDBurn Modem
+SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDBurn Modem
+
+if HAVE_LIBDDVD
+SUBDIRS += DVDPlayer
+endif
install_PYTHON = \
__init__.py
diff --git a/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml b/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml
index 2f9f22bf..ffbb8e89 100755
--- a/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml
+++ b/lib/python/Plugins/Extensions/MediaPlayer/meta/plugin_mediaplayer.xml
@@ -2,23 +2,14 @@
<prerequisites>
<tag type="Multimedia" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>MediaPlayer</name>
<packagename>enigma2-plugin-extensions-mediaplayer</packagename>
- <shortdescription>Mediaplayer plays your favorite music and videos.</shortdescription>
+ <shortdescription>Plays your favorite music and videos</shortdescription>
<description>Mediaplayer plays your favorite music and videos.\nPlay all your favorite music and video files, organize them in playlists, view cover and album information.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediaplayer_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>MediaPlayer</name>
- <packagename>enigma2-plugin-extensions-mediaplayer</packagename>
- <shortdescription>Mediaplayer spielt Ihre Musik und Videos.</shortdescription>
- <description>Mediaplayer spielt Ihre Musik und Videos.\nSie können all Ihre Musik- und Videodateien abspielen, in Playlisten organisieren, Cover und Albuminformationen abrufen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediaplayer_de.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-mediaplayer" />
</files>
diff --git a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
index 036bbbb9..d61dbc76 100755
--- a/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
+++ b/lib/python/Plugins/Extensions/MediaPlayer/plugin.py
@@ -110,7 +110,7 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
# 'None' is magic to start at the list of mountpoints
defaultDir = config.mediaplayer.defaultDir.getValue()
- self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
+ self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|mov|m2ts)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
self["filelist"] = self.filelist
self.playlist = MyPlayList()
@@ -901,11 +901,11 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
def unPauseService(self):
self.setSeekState(self.SEEK_STATE_PLAY)
-
+
def subtitleSelection(self):
- from Screens.Subtitles import Subtitles
- self.session.open(Subtitles, self)
-
+ from Screens.AudioSelection import SubtitleSelection
+ self.session.open(SubtitleSelection, self)
+
def hotplugCB(self, dev, media_state):
if dev == harddiskmanager.getCD():
if media_state == "1":
@@ -925,12 +925,17 @@ class MediaPlayer(Screen, InfoBarBase, InfoBarSeek, InfoBarAudioSelection, InfoB
self.clear_playlist()
class MediaPlayerLCDScreen(Screen):
- skin = """
- <screen position="0,0" size="132,64" title="LCD Text">
+ skin = (
+ """<screen name="MediaPlayerLCDScreen" position="0,0" size="132,64" id="1">
<widget name="text1" position="4,0" size="132,35" font="Regular;16"/>
<widget name="text3" position="4,36" size="132,14" font="Regular;10"/>
<widget name="text4" position="4,49" size="132,14" font="Regular;10"/>
- </screen>"""
+ </screen>""",
+ """<screen name="MediaPlayerLCDScreen" position="0,0" size="96,64" id="2">
+ <widget name="text1" position="0,0" size="96,35" font="Regular;14"/>
+ <widget name="text3" position="0,36" size="96,14" font="Regular;10"/>
+ <widget name="text4" position="0,49" size="96,14" font="Regular;10"/>
+ </screen>""")
def __init__(self, session, parent):
Screen.__init__(self, session)
diff --git a/lib/python/Plugins/Extensions/MediaPlayer/settings.py b/lib/python/Plugins/Extensions/MediaPlayer/settings.py
index 0b95812f..7f42677d 100755
--- a/lib/python/Plugins/Extensions/MediaPlayer/settings.py
+++ b/lib/python/Plugins/Extensions/MediaPlayer/settings.py
@@ -12,6 +12,8 @@ config.mediaplayer.repeat = ConfigYesNo(default=False)
config.mediaplayer.savePlaylistOnExit = ConfigYesNo(default=True)
config.mediaplayer.saveDirOnExit = ConfigYesNo(default=False)
config.mediaplayer.defaultDir = ConfigDirectory()
+config.mediaplayer.useAlternateUserAgent = ConfigYesNo(default=False)
+config.mediaplayer.alternateUserAgent = ConfigText(default="")
class DirectoryBrowser(Screen, HelpableScreen):
diff --git a/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml b/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml
index eced924f..eb9de1b6 100755
--- a/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml
+++ b/lib/python/Plugins/Extensions/MediaScanner/meta/plugin_mediascanner.xml
@@ -1,25 +1,15 @@
<default>
<prerequisites>
- <tag type="Multimedia" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>MediaScanner</name>
<packagename>enigma2-plugin-extensions-mediascanner</packagename>
- <shortdescription>MediaScanner scans devices for playable media files.</shortdescription>
+ <shortdescription>Scan devices for playable media files</shortdescription>
<description>MediaScanner scans devices for playable media files and displays a menu with possible actions like viewing pictures or playing movies.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediascanner_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>MediaScanner</name>
- <packagename>enigma2-plugin-extensions-mediascanner</packagename>
- <shortdescription>MediaScanner durchsucht Geräte nach Mediendateien.</shortdescription>
- <description>MediaScanner durchsucht Geräte nach Mediendateien und bietet Ihnen die dazu passenden Aktionen an wie z.B. Bilder betrachten oder Videos abspielen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_mediascanner_en.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-mediascanner" />
</files>
diff --git a/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml b/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml
index faff9785..16e2ec90 100755
--- a/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml
+++ b/lib/python/Plugins/Extensions/PicturePlayer/meta/plugin_pictureplayer.xml
@@ -2,23 +2,14 @@
<prerequisites>
<tag type="Multimedia" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>PicturePlayer</name>
<packagename>enigma2-plugin-extensions-pictureplayer</packagename>
- <shortdescription>PicturePlayer displays your photos on the TV.</shortdescription>
+ <shortdescription>Display your photos on the TV</shortdescription>
<description>The PicturePlayer displays your photos on the TV.\nYou can view them as thumbnails or slideshow.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_pictureplayer.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>Bildbetrachter</name>
- <packagename>enigma2-plugin-extensions-pictureplayer</packagename>
- <shortdescription>Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an.</shortdescription>
- <description>Der Bildbetrachter zeigt Ihre Bilder auf dem Fernseher an.\nSie können sich Ihre Bilder als Thumbnails, einzeln oder als Slideshow anzeigen lassen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_pictureplayer.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-pictureplayer" />
</files>
diff --git a/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml b/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml
index acf8374d..3eaf8fc5 100644..100755
--- a/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml
+++ b/lib/python/Plugins/Extensions/SocketMMI/meta/plugin_socketmmi.xml
@@ -2,20 +2,13 @@
<prerequisites>
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>SocketMMI</name>
<packagename>enigma2-plugin-extensions-socketmmi</packagename>
- <shortdescription>Python frontend for /tmp/mmi.socket.</shortdescription>
+ <shortdescription>Frontend for /tmp/mmi.socket</shortdescription>
<description>Python frontend for /tmp/mmi.socket.</description>
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>SocketMMI</name>
- <packagename>enigma2-plugin-extensions-socketmmi</packagename>
- <shortdescription>Python frontend für /tmp/mmi.socket.</shortdescription>
- <description>Python frontend für /tmp/mmi.socket.</description>
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-socketmmi" />
</files>
diff --git a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
index 8e80e183..5ce7d031 100644
--- a/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
+++ b/lib/python/Plugins/Extensions/SocketMMI/src/Makefile.am
@@ -1,17 +1,15 @@
-OBJS = socket_mmi.cpp
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/include \
+ -include Python.h \
+ -include $(top_builddir)/enigma2_config.h
--include $(OBJS:.cpp=.d)
+plugindir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI
-installdir = $(pkglibdir)/python/Plugins/Extensions/SocketMMI
+plugin_LTLIBRARIES = socketmmi.la
-install_PYTHON = \
- socketmmi.so
+socketmmi_la_SOURCES = \
+ socket_mmi.cpp \
+ socket_mmi.h
-socketmmi.so: socket_mmi.cpp socket_mmi.h
- $(CXX) $(CPPFLAGS) -MD $(CXXFLAGS) $(DEFS) -I$(top_srcdir)/include \
- -Wall -W $(OBJS) -shared -fPIC -Wl,-soname,socketmmi.so -o socketmmi.so \
- $(LDFLAGS)
-
-all: socketmmi.so
-
-CLEANFILES = socketmmi.so socketmmi.d
+socketmmi_la_LDFLAGS = -avoid-version -module
diff --git a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml
index 734c48f1..7ca10826 100644..100755
--- a/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml
+++ b/lib/python/Plugins/Extensions/TuxboxPlugins/meta/plugin_tuxboxplugins.xml
@@ -2,20 +2,13 @@
<prerequisites>
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>TuxboxPlugins</name>
<packagename>TuxboxPlugins</packagename>
- <shortdescription>Allows the execution of TuxboxPlugins.</shortdescription>
+ <shortdescription>Execute TuxboxPlugins</shortdescription>
<description>Allows the execution of TuxboxPlugins.</description>
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>TuxboxPlugins</name>
- <packagename>enigma2-plugin-extensions-tuxboxplugins</packagename>
- <shortdescription>Erlaubt das Ausführen von TuxboxPlugins.</shortdescription>
- <description>Erlaubt das Ausführen von TuxboxPlugins.</description>
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-extensions-tuxboxplugins" />
</files>
diff --git a/lib/python/Plugins/Makefile.am b/lib/python/Plugins/Makefile.am
index f0435036..79d2b0b6 100644
--- a/lib/python/Plugins/Makefile.am
+++ b/lib/python/Plugins/Makefile.am
@@ -4,3 +4,4 @@ SUBDIRS = Extensions SystemPlugins DemoPlugins
install_PYTHON = \
__init__.py Plugin.py
+
diff --git a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml
index 99add3d3..d0781af4 100755
--- a/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml
+++ b/lib/python/Plugins/SystemPlugins/CleanupWizard/meta/plugin_cleanupwizard.xml
@@ -2,26 +2,16 @@
<prerequisites>
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>CleanupWizard</name>
<packagename>enigma2-plugin-systemplugins-cleanupwizard</packagename>
<shortdescription>Automatically informs you on low internal memory</shortdescription>
- <description>The CleanupWizard informs you when your internal free memory of your dreambox has droppen under 2MB.
- You can use this wizard to remove some extensions.
- </description>
+ <description>The CleanupWizard informs you when the internal free memory of your dreambox has dropped below a definable threshold.
+ You can use this wizard to remove some plugins. </description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_cleanupwizard_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>CleanupWizard</name>
- <packagename>enigma2-plugin-systemplugins-cleanupwizard</packagename>
- <shortdescription>Informiert Sie automatisch wenn der interne Speicher Ihrer Dreambox voll wird.</shortdescription>
- <description>Der CleanupWizard informiert Sie, wenn der interne freie Speicher Ihrer Dreambox unter 2MB fällt.
- Sie können dann einige Erweiterungen deinstallieren um wieder Platz zu schaffen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_cleanupwizard_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-cleanupwizard" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml
index 9abc5986..f34f0a3c 100755
--- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml
+++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/plugin_commoninterfaceassignment.xml
@@ -4,28 +4,17 @@
<tag type="CI" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>CommonInterfaceAssignment</name>
<packagename>enigma2-plugin-systemplugins-commoninterfaceassignment</packagename>
- <shortdescription>Assigning providers/services/caids to a dedicated CI module</shortdescription>
- <description>With the CommonInterfaceAssignment extension it is possible to use different CI modules
- in your Dreambox and assign to each of them dedicated providers/services or caids.\n
- So it is then possible to watch a scrambled service while recording another one.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_ciassignment.jpg" />
- </info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>CommonInterfaceAssignment</name>
- <packagename>enigma2-plugin-systemplugins-commoninterfaceassignment</packagename>
- <shortdescription>Zuweisen von Providern/Services/CAIDs an ein CI Modul</shortdescription>
- <description>Mit der CommonInterfaceAssignment Erweiterung ist es möglich jedem CI Modul bestimmte Provider/Services/CAIDs zuzuweisen.\n
- So ist es möglich mit einem CI einen Sender aufzunehmen\n
- und mit einem anderen einen Sender zu schauen.
- </description>
+ <shortdescription>Assigning providers/services/caids to a CI module</shortdescription>
+ <description>With the CommonInterfaceAssignment plugin it is possible to use different
+ CI modules in your Dreambox and assign dedicated providers/services or caids to each of them.\n
+ This allows watching a scrambled service while recording another one.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_ciassignment.jpg" />
</info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-commoninterfaceassignment" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
index 2c0edf53..52296c66 100755
--- a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py
@@ -12,7 +12,7 @@ from ServiceReference import ServiceReference
from Plugins.Plugin import PluginDescriptor
from xml.etree.cElementTree import parse as ci_parse
from Tools.XMLTools import elementsWithTag, mergeText, stringToXML
-from enigma import eDVBCI_UI, eDVBCIInterfaces
+from enigma import eDVBCI_UI, eDVBCIInterfaces, eEnv
from os import system, path as os_path
@@ -115,7 +115,7 @@ class CIconfigMenu(Screen):
Screen.__init__(self, session)
self.ci_slot=ci_slot
- self.filename="/etc/enigma2/ci"+str(self.ci_slot)+".xml"
+ self.filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(self.ci_slot) + ".xml"
self["key_red"] = StaticText(_("Delete"))
self["key_green"] = StaticText(_("add Service"))
@@ -567,7 +567,7 @@ def activate_all(session):
return Len > 0 and definitions[Len-1].text or default
for ci in range(NUM_CI):
- filename="/etc/enigma2/ci"+str(ci)+".xml"
+ filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"
if not os_path.exists(filename):
print "[CI_Activate_Config_CI%d] no config file found" %ci
diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py
index e69de29b..7933e4cd 100755
--- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py
+++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py
@@ -0,0 +1,40 @@
+import sha
+
+def bin2long(s):
+ return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+ res = ""
+ for byte in range(128):
+ res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+ return res
+
+def rsa_pub1024(src, mod):
+ return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+
+def decrypt_block(src, mod):
+ if len(src) != 128 and len(src) != 202:
+ return None
+ dest = rsa_pub1024(src[:128], mod)
+ hash = sha.new(dest[1:107])
+ if len(src) == 202:
+ hash.update(src[131:192])
+ result = hash.digest()
+ if result == dest[107:127]:
+ return dest
+ return None
+
+def validate_cert(cert, key):
+ buf = decrypt_block(cert[8:], key)
+ if buf is None:
+ return None
+ return buf[36:107] + cert[139:196]
+
+def read_random():
+ try:
+ fd = open("/dev/urandom", "r")
+ buf = fd.read(8)
+ fd.close()
+ return buf
+ except:
+ return None \ No newline at end of file
diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml
index a118ed7f..3140b15f 100755
--- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml
+++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/meta/plugin_crashlogautosubmit.xml
@@ -2,26 +2,17 @@
<prerequisites>
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>CrashlogAutoSubmit</name>
<packagename>enigma2-plugin-systemplugins-crashlogautosubmit</packagename>
<shortdescription>Automatically send crashlogs to Dream Multimedia</shortdescription>
- <description>With the CrashlogAutoSubmit extension it is possible to automatically send crashlogs
- found on your Harddrive to Dream Multimedia
+ <description>With the CrashlogAutoSubmit plugin it is possible to automatically
+ mail crashlogs found on your hard drive to Dream Multimedia.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_crashlogautosubmit_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>CrashlogAutoSubmit</name>
- <packagename>enigma2-plugin-systemplugins-crashlogautosubmit</packagename>
- <shortdescription>Automatisches versenden von Crashlogs an Dream Multimedia</shortdescription>
- <description>Mit dem CrashlogAutoSubmit Plugin ist es möglich auf Ihrer Festplatte
- gefundene Crashlogs automatisch an Dream Multimedia zu versenden.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_crashlogautosubmit_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-crashlogautosubmit" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py
index 25639818..92c16289 100755
--- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py
@@ -8,12 +8,13 @@ from Screens.Screen import Screen
from Screens.VirtualKeyBoard import VirtualKeyBoard
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
-from enigma import ePoint
+from enigma import ePoint, eTPM
from Tools import Notifications
import os
from twisted.mail import smtp, relaymanager
import MimeWriter, mimetools, StringIO
+from __init__ import bin2long, long2bin, rsa_pub1024, decrypt_block, validate_cert, read_random
config.plugins.crashlogautosubmit = ConfigSubsection()
config.plugins.crashlogautosubmit.sendmail = ConfigSelection(default = "send", choices = [
@@ -376,11 +377,36 @@ def callCrashMailer(result,session):
def autostart(reason, **kwargs):
print "[CrashlogAutoSubmit] - autostart"
- if "session" in kwargs:
- try:
- startMailer(kwargs["session"])
- except ImportError, e:
- print "[CrashlogAutoSubmit] Twisted-mail not available, not starting CrashlogAutoSubmitter", e
+ try:
+ device = open("/proc/stb/info/model", "r").readline().strip()
+ except:
+ device = ""
+ if device != "dm7025":
+ rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+ etpm = eTPM()
+ l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+ if l2cert is None:
+ return
+ l2key = validate_cert(l2cert, rootkey)
+ if l2key is None:
+ return
+ l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+ if l3cert is None:
+ return
+ l3key = validate_cert(l3cert, l2key)
+ if l3key is None:
+ return
+ rnd = read_random()
+ if rnd is None:
+ return
+ val = etpm.challenge(rnd)
+ result = decrypt_block(val, l3key)
+ if device == "dm7025" or result[80:88] == rnd:
+ if "session" in kwargs:
+ try:
+ startMailer(kwargs["session"])
+ except ImportError, e:
+ print "[CrashlogAutoSubmit] Twisted-mail not available, not starting CrashlogAutoSubmitter", e
def openconfig(session, **kwargs):
diff --git a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml
index 41d41ed6..74b7886f 100755
--- a/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml
+++ b/lib/python/Plugins/SystemPlugins/DefaultServicesScanner/meta/plugin_defaultservicesscanner.xml
@@ -1,26 +1,18 @@
<default>
<prerequisites>
<tag type="SAT" />
- <tag type="System" />
+ <tag type="Default" />
</prerequisites>
<info language="en">
<author>Dream Multimedia</author>
<name>DefaultServicesScanner</name>
<packagename>enigma2-plugin-systemplugins-defaultservicesscanner</packagename>
- <shortdescription>Scans default lamedbs sorted by satellite with a connected dish positioner.</shortdescription>
- <description>With the DefaultServicesScanner extension you can scan default lamedbs sorted by satellite with a connected dish positioner.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_defaultservicescanner.jpg" />
- </info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>DefaultServicesScanner</name>
- <packagename>enigma2-plugin-systemplugins-defaultservicesscanner</packagename>
- <shortdescription>Standard Sendersuche nach Satellit mit einem Rotor.</shortdescription>
- <description>Mit der DefaultServicesScanner Erweiterung können Sie eine standard Sendersuche nach Satellit mit einem angeschlossenen Rotor durchführen.
+ <shortdescription>Scans default lamedbs sorted by satellite</shortdescription>
+ <description>With the DefaultServicesScanner plugin you can scan default lamedbs sorted by satellite with a connected dish positioner.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_defaultservicescanner.jpg" />
</info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-defaultservicesscanner" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml
index 33808b3e..567618b2 100755
--- a/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml
+++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/meta/plugin_diseqctester.xml
@@ -3,24 +3,16 @@
<tag type="SAT" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>DiseqcTester</name>
<packagename>enigma2-plugin-systemplugins-diseqctester</packagename>
- <shortdescription>Test your Diseqc equipment.</shortdescription>
- <description>With the DiseqcTester extension you can test your satellite equipment for Diseqc compatibility and errors.
+ <shortdescription>Test your DiSEqC equipment</shortdescription>
+ <description>With the DiseqcTester plugin you can test your satellite equipment for DiSEqC compatibility and errors.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_diseqctester_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>DiseqcTester</name>
- <packagename>enigma2-plugin-systemplugins-diseqctester</packagename>
- <shortdescription>Testet Ihr Diseqc Equipment.</shortdescription>
- <description>Mit der DiseqcTester Erweiterung können Sie Ihr Satelliten-Equipment nach Diseqc-Kompatibilität und Fehlern überprüfen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_diseqctester_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-diseqctester" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml
index 1763f67f..7b6fdca7 100644..100755
--- a/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml
+++ b/lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/plugin_frontprocessorupgrade.xml
@@ -3,24 +3,16 @@
<hardware type="dm8000" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>FrontprocessorUpgrade</name>
<packagename>enigma2-plugin-systemplugins-frontprocessorupgrade</packagename>
<packagetype>internal</packagetype> <!-- internal/public , public is default, internal metas are not displayed inside plugin manager -->
- <shortdescription>Internal firmware updater.</shortdescription>
+ <shortdescription>Internal firmware updater</shortdescription>
<description>This system tool is internally used to program the hardware with firmware updates.
</description>
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>FrontprocessorUpgrade</name>
- <packagename>enigma2-plugin-systemplugins-frontprocessorupgrade</packagename>
- <packagetype>internal</packagetype> <!-- internal/public , public is default, internal metas are not displayed inside plugin manager -->
- <shortdescription>Interner Firmware-Upgrader.</shortdescription>
- <description>Dieses Systemtool wird intern benutzt um Firmware-Upgrades für die Hardware aufzuspielen.
- </description>
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-frontprocessorupgrade" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml b/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml
index 6c2824ca..610dfee6 100644..100755
--- a/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml
+++ b/lib/python/Plugins/SystemPlugins/Hotplug/meta/plugin_hotplug.xml
@@ -2,22 +2,15 @@
<prerequisites>
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>Hotplug</name>
<packagename>enigma2-plugin-systemplugins-hotplug</packagename>
- <shortdescription>Hotplugging for removeable devices.</shortdescription>
- <description>The Hotplug extension notifies your system of newly added or removed devices.
- </description>
- </info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>Hotplug</name>
- <packagename>enigma2-plugin-systemplugins-hotplug</packagename>
- <shortdescription>Hotplugging für entfernbare Geräte.</shortdescription>
- <description>Mit der Hotplug-Erweiterung wird Ihr System über neu angeschlossene oder entfernte Geräte informiert.
+ <shortdescription>Hotplugging for removeable devices</shortdescription>
+ <description>The Hotplug plugin notifies your system of newly added or removed devices.
</description>
</info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-hotplug" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
index b19007c9..1f379f10 100644
--- a/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
@@ -1,66 +1,300 @@
from Plugins.Plugin import PluginDescriptor
-from twisted.internet.protocol import Protocol, Factory
-from twisted.internet import reactor
from Components.Harddisk import harddiskmanager
+from Tools.Directories import fileExists
hotplugNotifier = [ ]
+bdpoll = None
-class Hotplug(Protocol):
- def connectionMade(self):
- self.received = ""
+def processHotplugData(self, v):
+ print "hotplug:", v
+ action = v.get("ACTION")
+ device = v.get("DEVPATH")
+ physdevpath = v.get("PHYSDEVPATH")
+ media_state = v.get("X_E2_MEDIA_STATUS")
- def dataReceived(self, data):
- self.received += data
+ dev = device.split('/')[-1]
- def connectionLost(self, reason):
- data = self.received.split('\0')[:-1]
+ if action is not None and action == "add":
+ error, blacklisted, removable, is_cdrom, partitions, medium_found = harddiskmanager.addHotplugPartition(dev, physdevpath)
+ if bdpoll and removable or is_cdrom:
+ bdpoll.addDevice(dev, is_cdrom, medium_found)
+ elif action is not None and action == "remove":
+ if bdpoll:
+ bdpoll.removeDevice(dev)
+ harddiskmanager.removeHotplugPartition(dev)
+ elif media_state is not None:
+ if media_state == '1':
+ harddiskmanager.removeHotplugPartition(dev)
+ harddiskmanager.addHotplugPartition(dev, physdevpath)
+ elif media_state == '0':
+ harddiskmanager.removeHotplugPartition(dev)
- v = {}
+ for callback in hotplugNotifier:
+ try:
+ callback(dev, action or media_state)
+ except AttributeError:
+ hotplugNotifier.remove(callback)
- for x in data:
- i = x.find('=')
- var, val = x[:i], x[i+1:]
- v[var] = val
+CDROM_DRIVE_STATUS = 0x5326
+CDROM_MEDIA_CHANGED = 0x5325
+CDSL_CURRENT = ((int)(~0>>1))
+CDS_NO_INFO = 0
+CDS_NO_DISC = 1
+CDS_TRAY_OPEN = 2
+CDS_DRIVE_NOT_READY = 3
+CDS_DISC_OK = 4
+ENOMEDIUM = 159
+IOC_NRBITS = 8
+IOC_NRSHIFT = 0
+IOC_TYPESHIFT = (IOC_NRSHIFT+IOC_NRBITS)
+BLKRRPART = ((0x12<<IOC_TYPESHIFT) | (95<<IOC_NRSHIFT))
- print "hotplug:", v
+def autostart(reason, **kwargs):
+ if reason == 0:
+ print "starting hotplug handler"
- action = v.get("ACTION")
- device = v.get("DEVPATH")
- physdevpath = v.get("PHYSDEVPATH")
- media_state = v.get("X_E2_MEDIA_STATUS")
+ if fileExists('/dev/.udev'):
+ global netlink
+ global bdpoll
+ from enigma import eSocketNotifier, eTimer, ePythonMessagePump
+ import socket
+ from select import POLLIN, POLLPRI
- dev = device.split('/')[-1]
+ class Netlink:
+ def __init__(self):
+ self.netlink = socket.socket(socket.AF_NETLINK, socket.SOCK_DGRAM, 15)
+ self.netlink.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 65536)
+ self.netlink.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 65536)
+ self.netlink.bind((0, 1))
+ self.sn = eSocketNotifier(self.netlink.fileno(), POLLIN|POLLPRI)
+ self.sn.callback.append(self.dataAvail)
- if action is not None and action == "add":
- harddiskmanager.addHotplugPartition(dev, physdevpath)
- elif action is not None and action == "remove":
- harddiskmanager.removeHotplugPartition(dev)
- elif media_state is not None:
- if media_state == '1':
- harddiskmanager.removeHotplugPartition(dev)
- harddiskmanager.addHotplugPartition(dev, physdevpath)
- elif media_state == '0':
- harddiskmanager.removeHotplugPartition(dev)
-
- for callback in hotplugNotifier:
- try:
- callback(dev, action or media_state)
- except AttributeError:
- hotplugNotifier.remove(callback)
+ def dataAvail(self, what):
+ received = self.netlink.recvfrom(16384)
+# print "HOTPLUG(%d):" %(what), received
-def autostart(reason, **kwargs):
- if reason == 0:
- print "starting hotplug handler"
- factory = Factory()
- factory.protocol = Hotplug
+ data = received[0].split('\0')[:-1]
+ v = {}
+
+ for x in data:
+ i = x.find('=')
+ var, val = x[:i], x[i+1:]
+ v[var] = val
+
+ if v['SUBSYSTEM'] == 'block' and v['ACTION'] in ('add', 'remove'):
+ processHotplugData(self, v)
+
+ from threading import Thread, Semaphore, Lock
+
+ class ThreadQueue:
+ def __init__(self):
+ self.__list = [ ]
+ self.__lock = Lock()
+
+ def push(self, val):
+ list = self.__list
+ lock = self.__lock
+ lock.acquire()
+ list.append(val)
+ lock.release()
+
+ def pop(self):
+ list = self.__list
+ lock = self.__lock
+ lock.acquire()
+ ret = list[0]
+ del list[0]
+ lock.release()
+ return ret
- try:
import os
- os.remove("/tmp/hotplug.socket")
- except OSError:
- pass
+ import errno
+ import fcntl
+
+ class BDPoll(Thread):
+ CHECK_INTERVAL = 2000
+ MSG_MEDIUM_REMOVED = 1
+ MSG_MEDIUM_INSERTED = 2
+ MSG_POLL_FINISHED = 4
+ def __init__(self):
+ Thread.__init__(self)
+ self.__sema = Semaphore(0)
+ self.__lock = Lock()
+ self.running = False
+ self.devices_to_poll = { }
+ self.messages = ThreadQueue()
+ self.checkTimer = eTimer()
+ self.checkTimer.callback.append(self.timeout)
+ self.checkTimer.start(BDPoll.CHECK_INTERVAL, True)
+ self.mp = ePythonMessagePump()
+ self.mp.recv_msg.get().append(self.gotThreadMsg)
+ self.start()
+
+ def gotThreadMsg(self, msg):
+ msg = self.messages.pop()
+ if msg[0] == BDPoll.MSG_MEDIUM_REMOVED:
+ print "MSG_MEDIUM_REMOVED"
+ harddiskmanager.removeHotplugPartition(msg[1])
+ elif msg[0] == BDPoll.MSG_MEDIUM_INSERTED:
+ print "MSG_MEDIUM_INSERTED"
+ harddiskmanager.addHotplugPartition(msg[1])
+ elif msg[0] == BDPoll.MSG_POLL_FINISHED:
+ self.checkTimer.start(BDPoll.CHECK_INTERVAL, True)
+
+ def timeout(self):
+ self.__sema.release() # start bdpoll loop in thread
+
+ def is_mounted(self, dev):
+ mounts = file('/proc/mounts').read()
+ return mounts.find(dev) != -1
+
+ def run(self):
+ sema = self.__sema
+ lock = self.__lock
+ messages = self.messages
+ mp = self.mp
+ self.running = True
+ while self.running:
+ sema.acquire()
+ self.__lock.acquire()
+ devices_to_poll = self.devices_to_poll.items()
+ self.__lock.release()
+ devices_to_poll_processed = [ ]
+ for device, state in devices_to_poll:
+ got_media = False
+ is_cdrom, prev_media_state = state
+ if is_cdrom:
+ try:
+ fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK | os.O_EXCL)
+ except OSError, err:
+ if err.errno == errno.EBUSY:
+ print "open cdrom exclusive failed:",
+ if not self.is_mounted(device):
+ print "not mounted"
+ continue
+ try:
+ print "mounted... try non exclusive"
+ fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK)
+ except OSError, err:
+ print "open cdrom not exclusive failed", os.strerror(err.errno)
+ continue
+ #here the fs must be valid!
+ try:
+ ret = fcntl.ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)
+ except IOError, err:
+ print "ioctl CDROM_DRIVE_STATUS failed", os.strerror(err.errno)
+ else:
+ if ret in (CDS_NO_INFO, CDS_NO_DISC, CDS_TRAY_OPEN, CDS_DRIVE_NOT_READY):
+ pass
+ elif ret == CDS_DISC_OK:
+ #todo new kernels support events to userspace event on media change
+ #but not 2.6.18.... see hotplug-ng bdpoll.c
+ got_media = True
+ os.close(fd)
+ else:
+ try:
+ fd = os.open("/dev/" + device, os.O_RDONLY)
+ except OSError, err:
+ if err.errno == ENOMEDIUM:
+ pass
+ else:
+ print "open non cdrom failed", os.strerror(err.errno)
+ continue
+ else:
+ got_media = True
+ os.close(fd)
+ if prev_media_state:
+ if not got_media:
+ print "media removal detected on", device
+ try:
+ fd = os.open("/dev/" + device, os.O_RDONLY | os.O_NONBLOCK)
+ except OSError, err:
+ print "open device for blkrrpart ioctl failed", os.strerror(err.errno)
+ else:
+ try:
+ fcntl.ioctl(fd, BLKRRPART)
+ except IOError, err:
+ print "ioctl BLKRRPART failed", os.strerror(err.errno)
+ os.close(fd)
+ else:
+ if got_media:
+ print "media insertion detected on", device
+ devices_to_poll_processed.append((device, is_cdrom, got_media))
+ self.__lock.acquire()
+ for device, is_cdrom, state in devices_to_poll_processed:
+ old_state = self.devices_to_poll.get(device)
+ if old_state is not None and old_state[1] != state:
+ msg = state and BDPoll.MSG_MEDIUM_INSERTED or BDPoll.MSG_MEDIUM_REMOVED
+ self.devices_to_poll[device] = (is_cdrom, state)
+ messages.push((msg, device))
+ mp.send(0)
+
+ self.__lock.release()
+ messages.push((self.MSG_POLL_FINISHED,))
+ mp.send(0)
+
+ def addDevice(self, device, is_cdrom, inserted):
+ self.__lock.acquire()
+ if device in self.devices_to_poll:
+ print "device", device, "already in bdpoll"
+ else:
+ print "add device", device, "to bdpoll current state:",
+ if inserted:
+ print "medium inserted"
+ else:
+ print "medium removed"
+ self.devices_to_poll[device] = (is_cdrom, inserted)
+ self.__lock.release()
+
+ def removeDevice(self, device):
+ self.__lock.acquire()
+ if device in self.devices_to_poll:
+ print "device", device, "removed from bdpoll"
+ del self.devices_to_poll[device]
+ else:
+ print "try to del not exist device", device, "from bdpoll"
+ self.__lock.release()
+
+ netlink = Netlink()
+ bdpoll = BDPoll()
+ for blockdev, removable, is_cdrom, medium_found in harddiskmanager.devices_scanned_on_init:
+ if removable or is_cdrom:
+ bdpoll.addDevice(blockdev, is_cdrom, medium_found)
+ else:
+ from twisted.internet.protocol import Protocol, Factory
+ from twisted.internet import reactor
+
+ try:
+ import os
+ os.remove("/tmp/hotplug.socket")
+ except OSError:
+ pass
+
+ class Hotplug(Protocol):
+ def connectionMade(self):
+ print "HOTPLUG connection!"
+ self.received = ""
+
+ def dataReceived(self, data):
+ print "hotplug:", data
+ self.received += data
+ print "complete", self.received
+
+ def connectionLost(self, reason):
+ print "HOTPLUG connection lost!"
+ data = self.received.split('\0')[:-1]
+ v = {}
+
+ for x in data:
+ i = x.find('=')
+ var, val = x[:i], x[i+1:]
+ v[var] = val
+
+ processHotplugData(self, v)
- reactor.listenUNIX("/tmp/hotplug.socket", factory)
+ factory = Factory()
+ factory.protocol = Hotplug
+ reactor.listenUNIX("/tmp/hotplug.socket", factory)
def Plugins(**kwargs):
return PluginDescriptor(name = "Hotplug", description = "listens to hotplug events", where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart)
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand b/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand
deleted file mode 100755
index bd02d8fe..00000000
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand
+++ /dev/null
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py
index 6463f179..85ecc92d 100644
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py
+++ b/lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py
@@ -1,72 +1,222 @@
# -*- coding: utf-8 -*-
-from Components.MenuList import MenuList
+from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
+from Screens.HelpMenu import HelpableScreen
+from Screens.TaskView import JobView
+from Components.About import about
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
-from Components.Sources.Progress import Progress
+from Components.Sources.List import List
from Components.Label import Label
from Components.FileList import FileList
+from Components.MenuList import MenuList
from Components.MultiContent import MultiContentEntryText
from Components.ScrollLabel import ScrollLabel
-from Tools.Directories import fileExists
+from Components.Harddisk import harddiskmanager
+from Components.Task import Task, Job, job_manager, Condition
+from Tools.Directories import fileExists, isMount, resolveFilename, SCOPE_HDD, SCOPE_MEDIA
from Tools.HardwareInfo import HardwareInfo
-from enigma import eConsoleAppContainer, eListbox, gFont, eListboxPythonMultiContent, \
- RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eRect, eTimer
-from os import system, remove
-import re
-import urllib
from Tools.Downloader import downloadWithProgress
+from enigma import eConsoleAppContainer, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_VALIGN_CENTER, RT_WRAP, eTimer
+from os import system, path, access, stat, remove, W_OK, R_OK
from twisted.web import client
from twisted.internet import reactor, defer
from twisted.python import failure
-from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
-
-class UserRequestedCancel(Exception):
- pass
-
-class Feedlist(MenuList):
- def __init__(self, list=[], enableWrapAround = False):
- MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
- self.l.setFont(0, gFont("Regular", 16))
- self.l.setItemHeight(22)
+import re
- def clear(self):
- del self.list[:]
- self.l.setList(self.list)
+class ImageDownloadJob(Job):
+ def __init__(self, url, filename, device=None, mountpoint="/"):
+ Job.__init__(self, _("Download .NFI-Files for USB-Flasher"))
+ if device:
+ if isMount(mountpoint):
+ UmountTask(self, mountpoint)
+ MountTask(self, device, mountpoint)
+ ImageDownloadTask(self, url, mountpoint+filename)
+ ImageDownloadTask(self, url[:-4]+".nfo", mountpoint+filename[:-4]+".nfo")
+ #if device:
+ #UmountTask(self, mountpoint)
+
+ def retry(self):
+ self.tasks[0].args += self.tasks[0].retryargs
+ Job.retry(self)
+
+class MountTask(Task):
+ def __init__(self, job, device, mountpoint):
+ Task.__init__(self, job, ("mount"))
+ self.setTool("mount")
+ options = "rw,sync"
+ self.mountpoint = mountpoint
+ self.args += [ device, mountpoint, "-o"+options ]
+ self.weighting = 1
+
+ def processOutput(self, data):
+ print "[MountTask] output:", data
+
+class UmountTask(Task):
+ def __init__(self, job, mountpoint):
+ Task.__init__(self, job, ("mount"))
+ self.setTool("umount")
+ self.args += [mountpoint]
+ self.weighting = 1
+
+class DownloaderPostcondition(Condition):
+ def check(self, task):
+ return task.returncode == 0
+
+ def getErrorMessage(self, task):
+ return self.error_message
+
+class ImageDownloadTask(Task):
+ def __init__(self, job, url, path):
+ Task.__init__(self, job, _("Downloading"))
+ self.postconditions.append(DownloaderPostcondition())
+ self.job = job
+ self.url = url
+ self.path = path
+ self.error_message = ""
+ self.last_recvbytes = 0
+ self.error_message = None
+ self.download = None
+ self.aborted = False
- def getNFIname(self):
- l = self.l.getCurrentSelection()
- return l and l[0][0]
+ def run(self, callback):
+ self.callback = callback
+ self.download = downloadWithProgress(self.url,self.path)
+ self.download.addProgress(self.download_progress)
+ self.download.start().addCallback(self.download_finished).addErrback(self.download_failed)
+ print "[ImageDownloadTask] downloading", self.url, "to", self.path
- def getNFIurl(self):
- l = self.l.getCurrentSelection()
- return l and l[0][1]
+ def abort(self):
+ print "[ImageDownloadTask] aborting", self.url
+ if self.download:
+ self.download.stop()
+ self.aborted = True
- def getNFOname(self):
- l = self.l.getCurrentSelection()
- return l and l[0][0][:-3]+"nfo"
+ def download_progress(self, recvbytes, totalbytes):
+ #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes)
+ if ( recvbytes - self.last_recvbytes ) > 10000: # anti-flicker
+ self.progress = int(100*(float(recvbytes)/float(totalbytes)))
+ self.name = _("Downloading") + ' ' + "%d of %d kBytes" % (recvbytes/1024, totalbytes/1024)
+ self.last_recvbytes = recvbytes
- def getNFOurl(self):
- l = self.l.getCurrentSelection()
- return l and l[0][1][:-3]+"nfo"
+ def download_failed(self, failure_instance=None, error_message=""):
+ self.error_message = error_message
+ if error_message == "" and failure_instance is not None:
+ self.error_message = failure_instance.getErrorMessage()
+ Task.processFinished(self, 1)
- def isValid(self):
- l = self.l.getCurrentSelection()
- if not l or l[0] == 0:
- return False
+ def download_finished(self, string=""):
+ if self.aborted:
+ self.finish(aborted = True)
+ else:
+ Task.processFinished(self, 0)
+
+class StickWizardJob(Job):
+ def __init__(self, path):
+ Job.__init__(self, _("USB stick wizard"))
+ self.path = path
+ self.device = path
+ while self.device[-1:] == "/" or self.device[-1:].isdigit():
+ self.device = self.device[:-1]
+
+ box = HardwareInfo().get_device_name()
+ url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % box
+ self.downloadfilename = "/tmp/dreambox-nfiflasher-%s.tar.bz2" % box
+ self.imagefilename = "/tmp/nfiflash_%s.img" % box
+ #UmountTask(self, device)
+ PartitionTask(self)
+ ImageDownloadTask(self, url, self.downloadfilename)
+ UnpackTask(self)
+ CopyTask(self)
+
+class PartitionTaskPostcondition(Condition):
+ def check(self, task):
+ return task.returncode == 0
+
+ def getErrorMessage(self, task):
+ return {
+ task.ERROR_BLKRRPART: ("Device or resource busy"),
+ task.ERROR_UNKNOWN: (task.errormsg)
+ }[task.error]
+
+class PartitionTask(Task):
+ ERROR_UNKNOWN, ERROR_BLKRRPART = range(2)
+ def __init__(self, job):
+ Task.__init__(self, job, ("partitioning"))
+ self.postconditions.append(PartitionTaskPostcondition())
+ self.job = job
+ self.setTool("sfdisk")
+ self.args += [self.job.device]
+ self.weighting = 10
+ self.initial_input = "0 - 0x6 *\n;\n;\n;\ny"
+ self.errormsg = ""
+
+ def run(self, callback):
+ Task.run(self, callback)
+
+ def processOutput(self, data):
+ print "[PartitionTask] output:", data
+ if data.startswith("BLKRRPART:"):
+ self.error = self.ERROR_BLKRRPART
else:
- return True
+ self.error = self.ERROR_UNKNOWN
+ self.errormsg = data
+
+class UnpackTask(Task):
+ def __init__(self, job):
+ Task.__init__(self, job, ("Unpacking USB flasher image..."))
+ self.job = job
+ self.setTool("tar")
+ self.args += ["-xjvf", self.job.downloadfilename]
+ self.weighting = 80
+ self.end = 80
+ self.delayTimer = eTimer()
+ self.delayTimer.callback.append(self.progress_increment)
+
+ def run(self, callback):
+ Task.run(self, callback)
+ self.delayTimer.start(950, False)
+
+ def progress_increment(self):
+ self.progress += 1
+
+ def processOutput(self, data):
+ print "[UnpackTask] output: \'%s\'" % data
+ self.job.imagefilename = data
+
+ def afterRun(self):
+ self.delayTimer.callback.remove(self.progress_increment)
+
+class CopyTask(Task):
+ def __init__(self, job):
+ Task.__init__(self, job, ("Copying USB flasher boot image to stick..."))
+ self.job = job
+ self.setTool("dd")
+ self.args += ["if=%s" % self.job.imagefilename, "of=%s1" % self.job.device]
+ self.weighting = 20
+ self.end = 20
+ self.delayTimer = eTimer()
+ self.delayTimer.callback.append(self.progress_increment)
+
+ def run(self, callback):
+ Task.run(self, callback)
+ self.delayTimer.start(100, False)
+
+ def progress_increment(self):
+ self.progress += 1
+
+ def processOutput(self, data):
+ print "[CopyTask] output:", data
- def moveSelection(self,idx=0):
- if self.instance is not None:
- self.instance.moveSelectionTo(idx)
+ def afterRun(self):
+ self.delayTimer.callback.remove(self.progress_increment)
class NFOViewer(Screen):
skin = """
- <screen name="NFOViewer" position="110,115" size="540,400" title="Changelog viewer" >
- <widget name="changelog" position="10,10" size="520,380" font="Regular;16" />
+ <screen name="NFOViewer" position="center,center" size="610,410" title="Changelog" >
+ <widget name="changelog" position="10,10" size="590,380" font="Regular;16" />
</screen>"""
def __init__(self, session, nfo):
@@ -80,594 +230,576 @@ class NFOViewer(Screen):
"ok": self.exit,
"cancel": self.exit,
"down": self.pageDown,
- "up": self.pageUp
+ "up": self.pageUp
})
def pageUp(self):
self["changelog"].pageUp()
def pageDown(self):
self["changelog"].pageDown()
-
+
def exit(self):
self.close(False)
-class NFIDownload(Screen):
- LIST_SOURCE = 1
- LIST_DEST = 2
- skin = """
- <screen name="NFIDownload" position="90,95" size="560,420" title="Image download utility">
- <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#9f1313" transparent="1" />
- <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
- <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
- <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
-
- <widget source="label_top" render="Label" position="10,44" size="240,20" font="Regular;16" />
- <widget name="feedlist" position="10,66" size="250,222" scrollbarMode="showOnDemand" />
- <widget name="destlist" position="0,66" size="260,222" scrollbarMode="showOnDemand" />
+class feedDownloader:
+ def __init__(self, feed_base, box, OE_vers):
+ print "[feedDownloader::init] feed_base=%s, box=%s" % (feed_base, box)
+ self.feed_base = feed_base
+ self.OE_vers = OE_vers
+ self.box = box
+
+ def getList(self, callback, errback):
+ self.urlbase = "%s/%s/%s/images/" % (self.feed_base, self.OE_vers, self.box)
+ print "[getList]", self.urlbase
+ self.callback = callback
+ self.errback = errback
+ client.getPage(self.urlbase).addCallback(self.feed_finished).addErrback(self.feed_failed)
- <widget source="label_bottom" render="Label" position="10,312" size="240,18" font="Regular;16"/>
- <widget source="path_bottom" render="Label" position="10,330" size="250,42" font="Regular;18" />
-
- <widget source="infolabel" render="Label" position="270,44" size="280,284" font="Regular;16" />
- <widget source="job_progressbar" render="Progress" position="10,374" size="540,26" borderWidth="1" backgroundColor="#254f7497" />
- <widget source="job_progresslabel" render="Label" position="130,378" zPosition="2" font="Regular;18" halign="center" transparent="1" size="300,22" foregroundColor="#000000" />
- <widget source="statusbar" render="Label" position="10,404" size="540,16" font="Regular;16" foregroundColor="#cccccc" />
+ def feed_failed(self, failure_instance):
+ print "[feed_failed]", str(failure_instance)
+ self.errback(failure_instance.getErrorMessage())
+
+ def feed_finished(self, feedhtml):
+ print "[feed_finished]"
+ fileresultmask = re.compile("<a class=[\'\"]nfi[\'\"] href=[\'\"](?P<url>.*?)[\'\"]>(?P<name>.*?.nfi)</a>", re.DOTALL)
+ searchresults = fileresultmask.finditer(feedhtml)
+ fileresultlist = []
+ if searchresults:
+ for x in searchresults:
+ url = x.group("url")
+ if url[0:7] != "http://":
+ url = self.urlbase + x.group("url")
+ name = x.group("name")
+ entry = (name, url)
+ fileresultlist.append(entry)
+ self.callback(fileresultlist, self.OE_vers)
+
+class DeviceBrowser(Screen, HelpableScreen):
+ skin = """
+ <screen name="DeviceBrowser" position="center,center" size="520,430" title="Please select target medium" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="message" render="Label" position="5,50" size="510,150" font="Regular;16" />
+ <widget name="filelist" position="5,210" size="510,220" scrollbarMode="showOnDemand" />
</screen>"""
- def __init__(self, session, destdir="/tmp/"):
- self.skin = NFIDownload.skin
+ def __init__(self, session, startdir, message="", showDirectories = True, showFiles = True, showMountpoints = True, matchingPattern = "", useServiceRef = False, inhibitDirs = False, inhibitMounts = False, isTop = False, enableWrapAround = False, additionalExtensions = None):
Screen.__init__(self, session)
+
+ HelpableScreen.__init__(self)
+
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText()
+ self["message"] = StaticText(message)
+
+ self.filelist = FileList(startdir, showDirectories = showDirectories, showFiles = showFiles, showMountpoints = showMountpoints, matchingPattern = matchingPattern, useServiceRef = useServiceRef, inhibitDirs = inhibitDirs, inhibitMounts = inhibitMounts, isTop = isTop, enableWrapAround = enableWrapAround, additionalExtensions = additionalExtensions)
+ self["filelist"] = self.filelist
+
+ self["FilelistActions"] = ActionMap(["SetupActions", "ColorActions"],
+ {
+ "green": self.use,
+ "red": self.exit,
+ "ok": self.ok,
+ "cancel": self.exit
+ })
+
+ hotplugNotifier.append(self.hotplugCB)
+ self.onShown.append(self.updateButton)
+ self.onClose.append(self.removeHotplug)
+
+ def hotplugCB(self, dev, action):
+ print "[hotplugCB]", dev, action
+ self.updateButton()
+
+ def updateButton(self):
- self["job_progressbar"] = Progress()
- self["job_progresslabel"] = StaticText()
+ if self["filelist"].getFilename() or self["filelist"].getCurrentDirectory():
+ self["key_green"].text = _("Use")
+ else:
+ self["key_green"].text = ""
+
+ def removeHotplug(self):
+ print "[removeHotplug]"
+ hotplugNotifier.remove(self.hotplugCB)
+
+ def ok(self):
+ if self.filelist.canDescent():
+ if self["filelist"].showMountpoints == True and self["filelist"].showDirectories == False:
+ self.use()
+ else:
+ self.filelist.descent()
+
+ def use(self):
+ print "[use]", self["filelist"].getCurrentDirectory(), self["filelist"].getFilename()
+ if self["filelist"].getCurrentDirectory() is not None:
+ if self.filelist.canDescent() and self["filelist"].getFilename() and len(self["filelist"].getFilename()) > len(self["filelist"].getCurrentDirectory()):
+ self.filelist.descent()
+ self.close(self["filelist"].getCurrentDirectory())
+ elif self["filelist"].getFilename():
+ self.close(self["filelist"].getFilename())
+
+ def exit(self):
+ self.close(False)
+
+(ALLIMAGES, RELEASE, EXPERIMENTAL, STICK_WIZARD, START) = range(5)
+
+class NFIDownload(Screen):
+ skin = """
+ <screen name="NFIDownload" position="center,center" size="610,410" title="NFIDownload" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
+ <ePixmap pixmap="skin_default/border_menu_350.png" position="5,50" zPosition="1" size="350,300" transparent="1" alphatest="on" />
+ <widget source="menu" render="Listbox" position="15,60" size="330,290" scrollbarMode="showOnDemand">
+ <convert type="TemplatedMultiContent">
+ {"templates":
+ {"default": (25, [
+ MultiContentEntryText(pos = (2, 2), size = (330, 24), flags = RT_HALIGN_LEFT, text = 1), # index 0 is the MenuText,
+ ], True, "showOnDemand")
+ },
+ "fonts": [gFont("Regular", 22)],
+ "itemHeight": 25
+ }
+ </convert>
+ </widget>
+ <widget source="menu" render="Listbox" position="360,50" size="240,300" scrollbarMode="showNever" selectionDisabled="1">
+ <convert type="TemplatedMultiContent">
+ {"templates":
+ {"default": (300, [
+ MultiContentEntryText(pos = (2, 2), size = (240, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description,
+ ], False, "showNever")
+ },
+ "fonts": [gFont("Regular", 22)],
+ "itemHeight": 300
+ }
+ </convert>
+ </widget>
+ <widget source="status" render="Label" position="5,360" zPosition="10" size="600,50" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ </screen>"""
- self["infolabel"] = StaticText()
- self["statusbar"] = StaticText()
- self["label_top"] = StaticText()
- self["label_bottom"] = StaticText()
- self["path_bottom"] = StaticText()
+ def __init__(self, session, destdir=None):
+ Screen.__init__(self, session)
+ #self.skin_path = plugin_path
+ #self.menu = args
+ self.box = HardwareInfo().get_device_name()
+ self.feed_base = "http://www.dreamboxupdate.com/opendreambox" #/1.5/%s/images/" % self.box
+ self.usbmountpoint = resolveFilename(SCOPE_MEDIA)+"usb/"
+
+ self.menulist = []
+
+ self["menu"] = List(self.menulist)
+ self["key_red"] = StaticText(_("Close"))
self["key_green"] = StaticText()
self["key_yellow"] = StaticText()
self["key_blue"] = StaticText()
- self["key_red"] = StaticText()
-
- self["feedlist"] = Feedlist([0,(eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, "feed not available")])
- self["destlist"] = FileList(destdir, showDirectories = True, showFiles = False)
- self["destlist"].hide()
+ self["status"] = StaticText(_("Please wait... Loading list..."))
- self.download_container = eConsoleAppContainer()
- self.nfo = ""
- self.nfofile = ""
- self.feedhtml = ""
- self.focus = None
- self.download = None
- self.box = HardwareInfo().get_device_name()
- self.feed_base = "http://www.dreamboxupdate.com/opendreambox/1.5/%s/images/" % self.box
- self.nfi_filter = "" # "release" # only show NFIs containing this string, or all if ""
- self.wizard_mode = False
-
- self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "EPGSelectActions"],
+ self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"],
{
- "cancel": self.closeCB,
- "red": self.closeCB,
- "green": self.nfi_download,
- "yellow": self.switchList,
- "blue": self.askCreateUSBstick,
- "prevBouquet": self.switchList,
- "nextBouquet": self.switchList,
- "ok": self.ok,
- "left": self.left,
- "right": self.right,
- "up": self.up,
- "upRepeated": self.up,
- "downRepeated": self.down,
- "down": self.down
+ "ok": self.keyOk,
+ "green": self.keyOk,
+ "red": self.keyRed,
+ "blue": self.keyBlue,
+ "up": self.keyUp,
+ "upRepeated": self.keyUp,
+ "downRepeated": self.keyDown,
+ "down": self.keyDown,
+ "cancel": self.close,
}, -1)
+ self.onShown.append(self.go)
+ self.feedlists = [[],[],[]]
+ self.branch = START
+ self.container = eConsoleAppContainer()
+ self.container.dataAvail.append(self.tool_avail)
+ self.taskstring = ""
+ self.image_idx = 0
+ self.nfofilename = ""
+ self.nfo = ""
+ self.target_dir = None
- self.feed_download()
+ def tool_avail(self, string):
+ print "[tool_avail]" + string
+ self.taskstring += string
- def downloading(self, state=True):
- if state is True:
- self["key_red"].text = _("Cancel")
- self["key_green"].text = ""
- self["key_yellow"].text = ""
- self["key_blue"].text = ""
+ def go(self):
+ self.onShown.remove(self.go)
+ self.umountCallback = self.getMD5
+ self.umount()
+
+ def getMD5(self):
+ url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s-md5sums" % self.box
+ client.getPage(url).addCallback(self.md5sums_finished).addErrback(self.feed_failed)
+
+ def md5sums_finished(self, data):
+ print "[md5sums_finished]", data
+ self.stickimage_md5 = data
+ self.checkUSBStick()
+
+ def keyRed(self):
+ if self.branch == START:
+ self.close()
else:
- self.download = None
- self["key_red"].text = _("Exit")
- if self["feedlist"].isValid():
- self["key_green"].text = (_("Download"))
- if self.focus is self.LIST_SOURCE:
- self["key_yellow"].text = (_("Change dir."))
- else:
- self["key_yellow"].text = (_("Select image"))
- self["key_blue"].text = (_("USB stick wizard"))
-
- def switchList(self,to_where=None):
- if self.download or not self["feedlist"].isValid():
- return
-
- self["job_progressbar"].value = 0
- self["job_progresslabel"].text = ""
-
- if to_where is None:
- if self.focus is self.LIST_SOURCE:
- to_where = self.LIST_DEST
- if self.focus is self.LIST_DEST:
- to_where = self.LIST_SOURCE
-
- if to_where is self.LIST_DEST:
- self.focus = self.LIST_DEST
- self["statusbar"].text = _("Please select target directory or medium")
- self["label_top"].text = _("choose destination directory")+":"
- self["feedlist"].hide()
- self["destlist"].show()
- self["label_bottom"].text = _("Selected source image")+":"
- self["path_bottom"].text = str(self["feedlist"].getNFIname())
- self["key_yellow"].text = (_("Select image"))
-
- elif to_where is self.LIST_SOURCE:
- self.focus = self.LIST_SOURCE
- self["statusbar"].text = _("Please choose .NFI image file from feed server to download")
- self["label_top"].text = _("select image from server")+":"
- self["feedlist"].show()
- self["destlist"].hide()
- self["label_bottom"].text = _("Destination directory")+":"
- self["path_bottom"].text = str(self["destlist"].getCurrentDirectory())
- self["key_yellow"].text = (_("Change dir."))
-
- def up(self):
- if self.download:
- return
- if self.focus is self.LIST_SOURCE:
- self["feedlist"].up()
- self.nfo_download()
- if self.focus is self.LIST_DEST:
- self["destlist"].up()
-
- def down(self):
- if self.download:
- return
- if self.focus is self.LIST_SOURCE:
- self["feedlist"].down()
- self.nfo_download()
- if self.focus is self.LIST_DEST:
- self["destlist"].down()
-
- def left(self):
- if self.download:
- return
- if self.focus is self.LIST_SOURCE:
- self["feedlist"].pageUp()
- self.nfo_download()
- if self.focus is self.LIST_DEST:
- self["destlist"].pageUp()
-
- def right(self):
- if self.download:
- return
- if self.focus is self.LIST_SOURCE:
- self["feedlist"].pageDown()
- self.nfo_download()
- if self.focus is self.LIST_DEST:
- self["destlist"].pageDown()
+ self.branch = START
+ self["menu"].setList(self.menulist)
+ #elif self.branch == ALLIMAGES or self.branch == STICK_WIZARD:
- def ok(self):
- if self.focus is self.LIST_SOURCE and self.nfo:
+ def keyBlue(self):
+ if self.nfo != "":
self.session.open(NFOViewer, self.nfo)
- if self.download:
- return
- if self.focus is self.LIST_DEST:
- if self["destlist"].canDescent():
- self["destlist"].descent()
- def feed_download(self):
- self.downloading(True)
- self.download = self.feed_download
- client.getPage(self.feed_base).addCallback(self.feed_finished).addErrback(self.feed_failed)
+ def keyOk(self):
+ print "[keyOk]", self["menu"].getCurrent()
+ current = self["menu"].getCurrent()
+ if current:
+ if self.branch == START:
+ currentEntry = current[0]
+ if currentEntry == RELEASE:
+ self.image_idx = 0
+ self.branch = RELEASE
+ self.askDestination()
+ elif currentEntry == EXPERIMENTAL:
+ self.image_idx = 0
+ self.branch = EXPERIMENTAL
+ self.askDestination()
+ elif currentEntry == ALLIMAGES:
+ self.branch = ALLIMAGES
+ self.listImages()
+ elif currentEntry == STICK_WIZARD:
+ self.askStartWizard()
+ elif self.branch == ALLIMAGES:
+ self.image_idx = self["menu"].getIndex()
+ self.askDestination()
+ self.updateButtons()
+
+ def keyUp(self):
+ self["menu"].selectPrevious()
+ self.updateButtons()
+
+ def keyDown(self):
+ self["menu"].selectNext()
+ self.updateButtons()
+
+ def updateButtons(self):
+ current = self["menu"].getCurrent()
+ if current:
+ if self.branch == START:
+ self["key_red"].text = _("Close")
+ currentEntry = current[0]
+ if currentEntry in (RELEASE, EXPERIMENTAL):
+ self.nfo_download(currentEntry, 0)
+ self["key_green"].text = _("Download")
+ else:
+ self.nfofilename = ""
+ self.nfo = ""
+ self["key_blue"].text = ""
+ self["key_green"].text = _("continue")
+
+ elif self.branch == ALLIMAGES:
+ self["key_red"].text = _("Back")
+ self["key_green"].text = _("Download")
+ self.nfo_download(ALLIMAGES, self["menu"].getIndex())
+
+ def listImages(self):
+ print "[listImages]"
+ imagelist = []
+ mask = re.compile("%s/(?P<OE_vers>1\.\d)/%s/images/(?P<branch>.*?)-%s_(?P<version>.*?).nfi" % (self.feed_base, self.box, self.box), re.DOTALL)
+ for name, url in self.feedlists[ALLIMAGES]:
+ result = mask.match(url)
+ if result:
+ if result.group("version").startswith("20"):
+ version = ( result.group("version")[:4]+'-'+result.group("version")[4:6]+'-'+result.group("version")[6:8] )
+ else:
+ version = result.group("version")
+ description = "\nOpendreambox %s\n%s image\n%s\n" % (result.group("OE_vers"), result.group("branch"), version)
+ imagelist.append((url, name, _("Download %s from Server" ) % description, None))
+ self["menu"].setList(imagelist)
+
+ def getUSBPartitions(self):
+ allpartitions = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = True)]
+ print "[getUSBPartitions]", 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)
+ return usbpartition
+
+ def askDestination(self):
+ usbpartition = self.getUSBPartitions()
+ if len(usbpartition) == 1:
+ self.target_dir = usbpartition[0][1]
+ self.ackDestinationDevice(device_description=usbpartition[0][0])
+ else:
+ self.openDeviceBrowser()
+
+ def openDeviceBrowser(self):
+ self.session.openWithCallback(self.DeviceBrowserClosed, DeviceBrowser, None, showDirectories=True, showMountpoints=True, inhibitMounts=["/autofs/sr0/"])
+
+ def DeviceBrowserClosed(self, path):
+ print "[DeviceBrowserClosed]", str(path)
+ self.target_dir = path
+ if path:
+ self.ackDestinationDevice()
+ else:
+ self.keyRed()
+
+ def ackDestinationDevice(self, device_description=None):
+ if device_description == None:
+ dev = self.target_dir
+ else:
+ dev = device_description
+ message = _("Do you want to download the image to %s ?") % (dev)
+ choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.openDeviceBrowser), (_("Cancel"),self.keyRed)]
+ self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices)
+
+ def ackDestination_query(self, choice):
+ print "[ackDestination_query]", choice
+ if isinstance(choice, tuple):
+ choice[1]()
+ else:
+ self.keyRed()
+
+ def ackedDestination(self):
+ print "[ackedDestination]", self.branch, self.target_dir
+ self.container.setCWD(resolveFilename(SCOPE_MEDIA)+"usb/")
+ if self.target_dir[:8] == "/autofs/":
+ self.target_dir = "/dev/" + self.target_dir[8:-1]
+
+ if self.branch == STICK_WIZARD:
+ job = StickWizardJob(self.target_dir)
+ job.afterEvent = "close"
+ job_manager.AddJob(job)
+ job_manager.failed_jobs = []
+ self.session.openWithCallback(self.StickWizardCB, JobView, job, afterEventChangeable = False)
+
+ elif self.branch != STICK_WIZARD:
+ url = self.feedlists[self.branch][self.image_idx][1]
+ filename = self.feedlists[self.branch][self.image_idx][0]
+ print "[getImage] start downloading %s to %s" % (url, filename)
+ if self.target_dir.startswith("/dev/"):
+ job = ImageDownloadJob(url, filename, self.target_dir, self.usbmountpoint)
+ else:
+ job = ImageDownloadJob(url, filename, None, self.target_dir)
+ job.afterEvent = "close"
+ job_manager.AddJob(job)
+ job_manager.failed_jobs = []
+ self.session.openWithCallback(self.ImageDownloadCB, JobView, job, afterEventChangeable = False)
+
+ def StickWizardCB(self, ret=None):
+ print "[StickWizardCB]", ret
+# print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job
+ if len(job_manager.failed_jobs) == 0:
+ self.session.open(MessageBox, _("The USB stick was prepared to be bootable.\nNow you can download an NFI image file!"), type = MessageBox.TYPE_INFO)
+ if len(self.feedlists[ALLIMAGES]) == 0:
+ self.getFeed()
+ else:
+ self.setMenu()
+ else:
+ self.umountCallback = self.checkUSBStick
+ self.umount()
+
+ def ImageDownloadCB(self, ret):
+ print "[ImageDownloadCB]", ret
+# print job_manager.active_jobs, job_manager.failed_jobs, job_manager.job_classes, job_manager.in_background, job_manager.active_job
+ if len(job_manager.failed_jobs) == 0:
+ self.session.openWithCallback(self.askBackupCB, MessageBox, _("The wizard can backup your current settings. Do you want to do a backup now?"), MessageBox.TYPE_YESNO)
+ else:
+ self.umountCallback = self.keyRed
+ self.umount()
- def feed_failed(self, failure_instance):
- print "[feed_failed] " + str(failure_instance)
- self["infolabel"].text = _("Could not connect to Dreambox .NFI Image Feed Server:") + "\n" + failure_instance.getErrorMessage() + "\n\n" + _("Please check your network settings!")
- self.downloading(False)
+ def askBackupCB(self, ret):
+ if ret:
+ from Plugins.SystemPlugins.SoftwareManager.BackupRestore import BackupScreen
- def feed_finished(self, feedhtml):
- print "[feed_finished] " + str(feedhtml)
- self.downloading(False)
- fileresultmask = re.compile("<a class=[\'\"]nfi[\'\"] href=[\'\"](?P<url>.*?)[\'\"]>(?P<name>.*?.nfi)</a>", re.DOTALL)
- searchresults = fileresultmask.finditer(feedhtml)
- fileresultlist = []
- if searchresults:
- for x in searchresults:
- url = x.group("url")
- if url[0:7] != "http://":
- url = self.feed_base + x.group("url")
- name = x.group("name")
- if name.find(self.nfi_filter) > -1:
- entry = [[name, url],(eListboxPythonMultiContent.TYPE_TEXT, 0, 0,250, 30, 0, RT_HALIGN_LEFT|RT_VALIGN_CENTER, name)]
- print "adding to feedlist: " + str(entry)
- fileresultlist.append(entry)
- else:
- print "NOT adding to feedlist: " + name
- self["feedlist"].l.setList(fileresultlist)
- self["feedlist"].moveSelection(0)
+ class USBBackupScreen(BackupScreen):
+ def __init__(self, session, usbmountpoint):
+ BackupScreen.__init__(self, session, runBackup = True)
+ self.backuppath = usbmountpoint
+ self.fullbackupfilename = self.backuppath + "/" + self.backupfile
- if len(fileresultlist) > 0:
- self.switchList(self.LIST_SOURCE)
- self.nfo_download()
+ self.session.openWithCallback(self.showHint, USBBackupScreen, self.usbmountpoint)
else:
- self["infolabel"].text = _("Cannot parse feed directory")
-
- def nfo_download(self):
- print "[check_for_NFO]"
- if self["feedlist"].isValid():
- print "nfiname: " + self["feedlist"].getNFIname()
- self["job_progressbar"].value = 0
- self["job_progresslabel"].text = ""
- if self["feedlist"].getNFIurl() is None:
- self["key_green"].text = ""
- return
- self["key_green"].text = _("Download")
- nfourl = self["feedlist"].getNFOurl()
- print "downloading " + nfourl
- self.download = self.nfo_download
- self.downloading(True)
- client.getPage(nfourl).addCallback(self.nfo_finished).addErrback(self.nfo_failed)
- self["statusbar"].text = ("Downloading image description...")
+ 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)
+ else:
+ self.close()
+
+ def wizardQuery(self):
+ print "[wizardQuery]"
+ description = self.target_dir
+ for name, dev in self.getUSBPartitions():
+ if dev == self.target_dir:
+ description = name
+ message = _("You have chosen to create a new .NFI flasher bootable USB stick. This will repartition the USB stick and therefore all data on it will be erased.") + "\n"
+ message += _("The following device was found:\n\n%s\n\nDo you want to write the USB flasher to this stick?") % description
+ choices = [(_("Yes"), self.ackedDestination), (_("List of Storage Devices"),self.askStartWizard), (_("Cancel"),self.close)]
+ self.session.openWithCallback(self.ackDestination_query, ChoiceBox, title=message, list=choices)
+
+ def setMenu(self):
+ self.menulist = []
+ try:
+ latest_release = "Release %s (Opendreambox 1.5)" % self.feedlists[RELEASE][0][0][-9:-4]
+ self.menulist.append((RELEASE, _("Get latest release image"), _("Download %s from Server" ) % latest_release, None))
+ except IndexError:
+ pass
+
+ try:
+ dat = self.feedlists[EXPERIMENTAL][0][0][-12:-4]
+ latest_experimental = "Experimental %s-%s-%s (Opendreambox 1.6)" % (dat[:4], dat[4:6], dat[6:])
+ self.menulist.append((EXPERIMENTAL, _("Get latest experimental image"), _("Download %s from Server") % latest_experimental, None))
+ except IndexError:
+ pass
+
+ self.menulist.append((ALLIMAGES, _("Choose image to download"), _("Select desired image from feed list" ), None))
+ self.menulist.append((STICK_WIZARD, _("USB stick wizard"), _("Prepare another USB stick for image flashing" ), None))
+ self["menu"].setList(self.menulist)
+ self["status"].text = _("Currently installed image") + ": %s" % (about.getImageVersionString())
+ self.branch = START
+ self.updateButtons()
+
+ def nfo_download(self, branch, idx):
+ nfourl = (self.feedlists[branch][idx][1])[:-4]+".nfo"
+ self.nfofilename = (self.feedlists[branch][idx][0])[:-4]+".nfo"
+ print "[check_for_NFO]", nfourl
+ client.getPage(nfourl).addCallback(self.nfo_finished).addErrback(self.nfo_failed)
def nfo_failed(self, failure_instance):
print "[nfo_failed] " + str(failure_instance)
- self["infolabel"].text = _("No details for this image file") + "\n" + self["feedlist"].getNFIname()
- self["statusbar"].text = ""
+ self["key_blue"].text = ""
self.nfofilename = ""
self.nfo = ""
- self.downloading(False)
def nfo_finished(self,nfodata=""):
print "[nfo_finished] " + str(nfodata)
- self.downloading(False)
+ self["key_blue"].text = _("Changelog")
self.nfo = nfodata
- if self.nfo != "":
- self.nfofilename = self["destlist"].getCurrentDirectory() + '/' + self["feedlist"].getNFOname()
- self["infolabel"].text = self.nfo
- else:
- self.nfofilename = ""
- self["infolabel"].text = _("No details for this image file")
- self["statusbar"].text = _("Press OK to view full changelog")
-
- def nfi_download(self):
- if self["destlist"].getCurrentDirectory() is None:
- self.switchList(self.LIST_TARGET)
- if self["feedlist"].isValid():
- url = self["feedlist"].getNFIurl()
- self.nfilocal = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname()
- print "[nfi_download] downloading %s to %s" % (url, self.nfilocal)
- self.download = downloadWithProgress(url,self.nfilocal)
- self.download.addProgress(self.nfi_progress)
- self["job_progressbar"].range = 1000
- self.download.start().addCallback(self.nfi_finished).addErrback(self.nfi_failed)
- self.downloading(True)
-
- def nfi_progress(self, recvbytes, totalbytes):
- #print "[update_progress] recvbytes=%d, totalbytes=%d" % (recvbytes, totalbytes)
- self["job_progressbar"].value = int(1000*recvbytes/float(totalbytes))
- self["job_progresslabel"].text = "%d of %d kBytes (%.2f%%)" % (recvbytes/1024, totalbytes/1024, 100*recvbytes/float(totalbytes))
- def nfi_failed(self, failure_instance=None, error_message=""):
- if error_message == "" and failure_instance is not None:
- error_message = failure_instance.getErrorMessage()
- print "[nfi_failed] " + error_message
- if fileExists(self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname()):
- message = "%s %s\n%s" % (_(".NFI Download failed:"), error_message, _("Remove the incomplete .NFI file?"))
- self.session.openWithCallback(self.nfi_remove, MessageBox, message, MessageBox.TYPE_YESNO)
- else:
- message = "%s %s" % (_(".NFI Download failed:"),error_message)
- self.session.open(MessageBox, message, MessageBox.TYPE_ERROR)
- self.downloading(False)
-
- def nfi_finished(self, string=""):
- print "[nfi_finished] " + str(string)
- if self.nfo != "":
- self.nfofilename = self["destlist"].getCurrentDirectory() + '/' + self["feedlist"].getNFOname()
- nfofd = open(self.nfofilename, "w")
- if nfofd:
- nfofd.write(self.nfo)
- nfofd.close()
- else:
- print "couldn't save nfo file " + self.nfofilename
-
- pos = self.nfo.find("MD5:")
- if pos > 0 and len(self.nfo) >= pos+5+32:
- self["statusbar"].text = ("Please wait for md5 signature verification...")
- cmd = "md5sum -c -"
- md5 = self.nfo[pos+5:pos+5+32] + " " + self.nfilocal
- print cmd, md5
- self.download_container.setCWD(self["destlist"].getCurrentDirectory())
- self.download_container.appClosed.append(self.md5finished)
- self.download_container.execute(cmd)
- self.download_container.write(md5)
- self.download_container.dataSent.append(self.md5ready)
- else:
- self["statusbar"].text = "Download completed."
- self.downloading(False)
- else:
- self["statusbar"].text = "Download completed."
- self.downloading(False)
- if self.wizard_mode:
- self.configBackup()
+ def md5verify(self, md5, path):
+ cmd = "md5sum -c -s"
+ print "[verify_md5]", md5, path, cmd
+ self.container.setCWD(path)
+ self.container.appClosed.append(self.md5finished)
+ self.container.execute(cmd)
+ self.container.write(md5)
+ self.container.dataSent.append(self.md5ready)
def md5ready(self, retval):
- self.download_container.sendEOF()
+ self.container.sendEOF()
def md5finished(self, retval):
- print "[md5finished]: " + str(retval)
- self.download_container.appClosed.remove(self.md5finished)
+ print "[md5finished]", str(retval)
+ self.container.appClosed.remove(self.md5finished)
+ self.container.dataSent.remove(self.md5ready)
if retval==0:
- self.downloading(False)
- if self.wizard_mode:
- self.configBackup()
- else:
- self["statusbar"].text = _(".NFI file passed md5sum signature check. You can safely flash this image!")
- self.switchList(self.LIST_SOURCE)
+ print "check passed! calling", repr(self.md5_passback)
+ self.md5_passback()
else:
- self.session.openWithCallback(self.nfi_remove, MessageBox, (_("The md5sum validation failed, the file may be downloaded incompletely or be corrupted!") + "\n" + _("Remove the broken .NFI file?")), MessageBox.TYPE_YESNO)
-
- def nfi_remove(self, answer):
- self.downloading(False)
- if answer == True:
- nfifilename = self["destlist"].getCurrentDirectory()+'/'+self["feedlist"].getNFIname()
- if fileExists(self.nfofilename):
- remove(self.nfofilename)
- if fileExists(nfifilename):
- remove(nfifilename)
- self.switchList(self.LIST_SOURCE)
-
- def askCreateUSBstick(self):
- self.downloading()
- self.imagefilename = "/tmp/nfiflash_" + self.box + ".img"
- message = _("You have chosen to create a new .NFI flasher bootable USB stick. This will repartition the USB stick and therefore all data on it will be erased.")
- self.session.openWithCallback(self.flasherdownload_query, MessageBox, (message + '\n' + _("First we need to download the latest boot environment for the USB flasher.")), MessageBox.TYPE_YESNO)
-
- def flasherdownload_query(self, answer):
- if answer is False:
- self.downloading(False)
- self.switchList(self.LIST_SOURCE)
- return
- #url = self.feed_base + "/nfiflasher_" + self.box + ".tar.bz2"
- url = "http://www.dreamboxupdate.com/download/opendreambox/dreambox-nfiflasher-%s.tar.bz2" % self.box
- localfile = "/tmp/nfiflasher_image.tar.bz2"
- print "[flasherdownload_query] downloading %s to %s" % (url, localfile)
- self["statusbar"].text = ("Downloading %s..." % url)
- self.download = downloadWithProgress(url,localfile)
- self.download.addProgress(self.nfi_progress)
- self["job_progressbar"].range = 1000
- self.download.start().addCallback(self.flasherdownload_finished).addErrback(self.flasherdownload_failed)
-
- def flasherdownload_failed(self, failure_instance=None, error_message=""):
- if error_message == "" and failure_instance is not None:
- error_message = failure_instance.getErrorMessage()
- print "[flasherdownload_failed] " + error_message
- message = "%s %s" % (_("Download of USB flasher boot image failed: "),error_message)
- self.session.open(MessageBox, message, MessageBox.TYPE_ERROR)
- self.remove_img(True)
-
- def flasherdownload_finished(self, string=""):
- print "[flasherdownload_finished] " + str(string)
- self.container = eConsoleAppContainer()
- self.container.appClosed.append(self.umount_finished)
- self.container.dataAvail.append(self.tool_avail)
- self.taskstring = ""
- umountdevs = ""
- from os import listdir
- for device in listdir("/dev"):
- if device[:2] == "sd" and device[-1:].isdigit():
- umountdevs += "/dev/"+device
- self.cmd = "umount " + umountdevs
- print "executing " + self.cmd
- self.container.execute(self.cmd)
-
- def tool_avail(self, string):
- print "[tool_avail]" + string
- self.taskstring += string
-
- def umount_finished(self, retval):
- self.container.appClosed.remove(self.umount_finished)
- self.container.appClosed.append(self.dmesg_cleared)
- self.taskstring = ""
- self.cmd = "dmesg -c"
- print "executing " + self.cmd
- self.container.execute(self.cmd)
-
- def dmesg_cleared(self, answer):
- self.container.appClosed.remove(self.dmesg_cleared)
- 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)
+ print "check failed! calling", repr(self.md5_failback)
+ self.md5_failback()
- def hotplugCB(self, dev, action):
- print "[hotplugCB]", dev, action
- if dev.startswith("sd") and action == "add":
- self.msgbox.close()
- hotplugNotifier.remove(self.hotplugCB)
- self.container.appClosed.append(self.dmesg_scanned)
- self.taskstring = ""
- self.cmd = "dmesg"
- print "executing " + self.cmd
- self.container.execute(self.cmd)
-
- def dmesg_scanned(self, retval):
- self.container.appClosed.remove(self.dmesg_scanned)
- dmesg_lines = self.taskstring.splitlines()
- self.devicetext = None
- self.stickdevice = None
- for i, line in enumerate(dmesg_lines):
- if line.find("usb-storage: waiting for device") != -1 and len(dmesg_lines) > i+3:
- self.devicetext = dmesg_lines[i+1].lstrip()+"\n"+dmesg_lines[i+3]
- elif line.find("/dev/scsi/host") != -1:
- self.stickdevice = line.split(":",1)[0].lstrip()
-
- if retval != 0 or self.devicetext is None or self.stickdevice is None:
- self.session.openWithCallback(self.remove_img, MessageBox, _("No useable USB stick found"), MessageBox.TYPE_ERROR)
- else:
- self.session.openWithCallback(self.fdisk_query, MessageBox, (_("The following device was found:\n\n%s\n\nDo you want to write the USB flasher to this stick?") % self.devicetext), MessageBox.TYPE_YESNO)
-
- def fdisk_query(self, answer):
- if answer == True and self.stickdevice:
- self["statusbar"].text = ("Partitioning USB stick...")
- self["job_progressbar"].range = 1000
- self["job_progressbar"].value = 100
- self["job_progresslabel"].text = "5.00%"
- self.taskstring = ""
- self.container.appClosed.append(self.fdisk_finished)
- self.container.execute("fdisk " + self.stickdevice + "/disc")
- self.container.write("d\n4\nd\n3\nd\n2\nd\nn\np\n1\n\n\nt\n6\nw\n")
- self.delayTimer = eTimer()
- self.delayTimer.callback.append(self.progress_increment)
- self.delayTimer.start(105, False)
- else:
- self.remove_img(True)
-
- def fdisk_finished(self, retval):
- self.container.appClosed.remove(self.fdisk_finished)
- self.delayTimer.stop()
- if retval == 0:
- if fileExists(self.imagefilename):
- self.tar_finished(0)
- self["job_progressbar"].value = 700
- else:
- self["statusbar"].text = ("Decompressing USB stick flasher boot image...")
- self.taskstring = ""
- self.container.appClosed.append(self.tar_finished)
- self.container.setCWD("/tmp")
- self.cmd = "tar -xjvf nfiflasher_image.tar.bz2"
- self.container.execute(self.cmd)
- print "executing " + self.cmd
- self.delayTimer = eTimer()
- self.delayTimer.callback.append(self.progress_increment)
- self.delayTimer.start(105, False)
- else:
- print "fdisk failed: " + str(retval)
- self.session.openWithCallback(self.remove_img, MessageBox, ("fdisk " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR)
+ def umount(self):
+ cmd = "umount " + self.usbmountpoint
+ print "[umount]", cmd
+ self.container.setCWD('/')
+ self.container.appClosed.append(self.umountFinished)
+ self.container.execute(cmd)
- def progress_increment(self):
- newval = int(self["job_progressbar"].value) + 1
- if newval < 950:
- self["job_progressbar"].value = newval
- self["job_progresslabel"].text = "%.2f%%" % (newval/10.0)
-
- def tar_finished(self, retval):
- self.delayTimer.stop()
- if len(self.container.appClosed) > 0:
- self.container.appClosed.remove(self.tar_finished)
- if retval == 0:
- self.imagefilename = "/tmp/nfiflash_" + self.box + ".img"
- self["statusbar"].text = ("Copying USB flasher boot image to stick...")
- self.taskstring = ""
- self.container.appClosed.append(self.dd_finished)
- self.cmd = "dd if=%s of=%s" % (self.imagefilename,self.stickdevice+"/part1")
- self.container.execute(self.cmd)
- print "executing " + self.cmd
- self.delayTimer = eTimer()
- self.delayTimer.callback.append(self.progress_increment)
- self.delayTimer.start(105, False)
- else:
- self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR)
-
- def dd_finished(self, retval):
- self.delayTimer.stop()
- self.container.appClosed.remove(self.dd_finished)
- self.downloading(False)
- if retval == 0:
- self["job_progressbar"].value = 950
- self["job_progresslabel"].text = "95.00%"
- self["statusbar"].text = ("Remounting stick partition...")
- self.taskstring = ""
- self.container.appClosed.append(self.mount_finished)
- self.cmd = "mount %s /mnt/usb -o rw,sync" % (self.stickdevice+"/part1")
- self.container.execute(self.cmd)
- print "executing " + self.cmd
- else:
- self.session.openWithCallback(self.remove_img, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR)
-
- def mount_finished(self, retval):
- self.container.dataAvail.remove(self.tool_avail)
- self.container.appClosed.remove(self.mount_finished)
- if retval == 0:
- self["job_progressbar"].value = 1000
- self["job_progresslabel"].text = "100.00%"
- self["statusbar"].text = (".NFI Flasher bootable USB stick successfully created.")
- self.session.openWithCallback(self.flasherFinishedCB, MessageBox, _("The USB stick is now bootable. Do you want to download the latest image from the feed server and save it on the stick?"), type = MessageBox.TYPE_YESNO)
- self["destlist"].changeDir("/mnt/usb")
- else:
- self.session.openWithCallback(self.flasherFinishedCB, MessageBox, (self.cmd + " " + _("failed") + ":\n" + str(self.taskstring)), MessageBox.TYPE_ERROR)
- self.remove_img(True)
-
- def remove_img(self, answer):
- if fileExists("/tmp/nfiflasher_image.tar.bz2"):
- remove("/tmp/nfiflasher_image.tar.bz2")
- if fileExists(self.imagefilename):
- remove(self.imagefilename)
- self.downloading(False)
- self.switchList(self.LIST_SOURCE)
-
- def flasherFinishedCB(self, answer):
- if answer == True:
- self.wizard_mode = True
- self["feedlist"].moveSelection(0)
- self["path_bottom"].text = str(self["destlist"].getCurrentDirectory())
- self.nfo_download()
- self.nfi_download()
-
- def configBackup(self):
- self.session.openWithCallback(self.runBackup, MessageBox, _("The wizard can backup your current settings. Do you want to do a backup now?"))
-
- def runBackup(self, result=None):
- from Tools.Directories import createDir, isMount, pathExists
- from time import localtime
- from datetime import date
- from Screens.Console import Console
- if result:
- if isMount("/mnt/usb/"):
- if (pathExists("/mnt/usb/backup") == False):
- createDir("/mnt/usb/backup", True)
- d = localtime()
- dt = date(d.tm_year, d.tm_mon, d.tm_mday)
- self.backup_file = "backup/" + str(dt) + "_settings_backup.tar.gz"
- self.session.open(Console, title = "Backup running", cmdlist = ["tar -czvf " + "/mnt/usb/" + self.backup_file + " /etc/enigma2/ /etc/network/interfaces /etc/wpa_supplicant.conf"], finishedCallback = self.backup_finished, closeOnSuccess = True)
- else:
- self.backup_file = None
- self.backup_finished(skipped=True)
-
- def backup_finished(self, skipped=False):
- if not skipped:
- wizardfd = open("/mnt/usb/wizard.nfo", "w")
- if wizardfd:
- wizardfd.write("image: "+self["feedlist"].getNFIname()+'\n')
- wizardfd.write("configuration: "+self.backup_file+'\n')
- wizardfd.close()
- self.session.open(MessageBox, _("To update your Dreambox firmware, please follow these steps:\n1) Turn off your box with the rear power switch and plug in the bootable USB stick.\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)
-
- def closeCB(self):
- try:
- self.download.stop()
- #self.nfi_failed(None, "Cancelled by user request")
- self.downloading(False)
- except AttributeError:
- self.close()
+ def umountFinished(self, retval):
+ print "[umountFinished]", str(retval)
+ self.container.appClosed.remove(self.umountFinished)
+ self.umountCallback()
def main(session, **kwargs):
- session.open(NFIDownload,"/home/root")
+ session.open(NFIDownload,resolveFilename(SCOPE_HDD))
def filescan_open(list, session, **kwargs):
dev = "/dev/" + (list[0].path).rsplit('/',1)[0][7:]
- print "mounting device " + dev + " to /mnt/usb..."
- system("mount "+dev+" /mnt/usb/ -o rw,sync")
- session.open(NFIDownload,"/mnt/usb/")
+ print "mounting device " + dev + " to /media/usb..."
+ usbmountpoint = resolveFilename(SCOPE_MEDIA)+"usb/"
+ system("mount %s %s -o rw,sync" % (dev, usbmountpoint))
+ session.open(NFIDownload,usbmountpoint)
def filescan(**kwargs):
from Components.Scanner import Scanner, ScanPath
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py
index 8986560b..3504d4cb 100644..100755
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py
+++ b/lib/python/Plugins/SystemPlugins/NFIFlash/flasher.py
@@ -2,31 +2,62 @@ from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.Standby import TryQuitMainloop
+from Screens.Console import Console
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.Sources.Progress import Progress
from Components.Sources.Boolean import Boolean
from Components.Label import Label
from Components.FileList import FileList
-from Components.Task import Task, Job, JobManager
+from Components.Task import Task, Job, job_manager, Condition
+from Screens.TaskView import JobView
from Tools.Directories import fileExists
from Tools.HardwareInfo import HardwareInfo
from os import system
-from enigma import eConsoleAppContainer
-import re
+from enigma import eConsoleAppContainer, quitMainloop, eEnv
+from Components.About import about
+
+class md5Postcondition(Condition):
+ def check(self, task):
+ print "md5Postcondition::check", task.returncode
+ return task.returncode == 0
+
+ def getErrorMessage(self, task):
+ if task.returncode == 1:
+ return _("The md5sum validation failed, the file may be corrupted!")
+ return "md5 error"
+
+class md5verify(Task):
+ def __init__(self, job, path, md5):
+ Task.__init__(self, job, "md5sum")
+ self.postconditions.append(md5Postcondition())
+ self.weighting = 5
+ self.cwd = path
+ self.setTool("md5sum")
+ self.args += ["-c", "-s"]
+ self.initial_input = md5
+
+ def writeInput(self, input):
+ self.container.dataSent.append(self.md5ready)
+ print "[writeInput]", input
+ Task.writeInput(self, input)
+
+ def md5ready(self, retval):
+ self.container.sendEOF()
+
+ def processOutput(self, data):
+ print "[md5sum]",
class writeNAND(Task):
- def __init__(self,job,param,box):
+ def __init__(self, job, param, box):
Task.__init__(self,job, ("Writing image file to NAND Flash"))
- self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/mywritenand")
+ self.setTool(eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/NFIFlash/writenfi-mipsel-2.6.18-r1"))
if box == "dm7025":
self.end = 256
elif box[:5] == "dm800":
self.end = 512
- if box == "dm8000":
- self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand")
self.args += param
- self.weighting = 1
+ self.weighting = 95
def processOutput(self, data):
print "[writeNand] " + data
@@ -38,143 +69,93 @@ class writeNAND(Task):
else:
self.output_line = data
-class NFISummary(Screen):
- skin = """
- <screen position="0,0" size="132,64">
- <widget source="title" render="Label" position="2,0" size="120,14" valign="center" font="Regular;12" />
- <widget source="content" render="Label" position="2,14" size="120,34" font="Regular;12" transparent="1" zPosition="1" />
- <widget source="job_progresslabel" render="Label" position="66,50" size="60,14" font="Regular;12" transparent="1" halign="right" zPosition="0" />
- <widget source="job_progressbar" render="Progress" position="2,50" size="66,14" borderWidth="1" />
- </screen>"""
-
- def __init__(self, session, parent):
- Screen.__init__(self, session, parent)
- self["title"] = StaticText(_("Image flash utility"))
- self["content"] = StaticText(_("Please select .NFI flash image file from medium"))
- self["job_progressbar"] = Progress()
- self["job_progresslabel"] = StaticText("")
-
- def setText(self, text):
- self["content"].setText(text)
-
class NFIFlash(Screen):
skin = """
- <screen name="NFIFlash" position="90,95" size="560,420" title="Image flash utility">
- <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" zPosition="0" size="140,40" transparent="1" alphatest="on" />
- <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
- <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
- <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;19" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
- <widget source="listlabel" render="Label" position="10,44" size="250,20" font="Regular;16" />
- <widget name="filelist" position="0,68" size="260,260" scrollbarMode="showOnDemand" />
- <widget source="infolabel" render="Label" position="270,44" size="280,284" font="Regular;16" />
- <widget source="job_progressbar" render="Progress" position="10,374" size="540,26" borderWidth="1" backgroundColor="#254f7497" />
- <widget source="job_progresslabel" render="Label" position="180,378" zPosition="2" font="Regular;18" halign="center" transparent="1" size="200,22" foregroundColor="#000000" />
- <widget source="statusbar" render="Label" position="10,404" size="540,16" font="Regular;16" foregroundColor="#cccccc" />
- </screen>"""
+ <screen name="NFIFlash" position="center,center" size="610,410" title="Image flash utility" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1" />
+ <ePixmap pixmap="skin_default/border_menu_350.png" position="5,50" zPosition="1" size="350,300" transparent="1" alphatest="on" />
+ <widget name="filelist" position="15,60" size="330,284" scrollbarMode="showOnDemand" />
+ <widget source="infolabel" render="Label" position="360,50" size="240,300" font="Regular;13" />
+ <widget source="status" render="Label" position="5,360" zPosition="10" size="600,50" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ </screen>"""
- def __init__(self, session, cancelable = True, close_on_finish = False):
- self.skin = NFIFlash.skin
+ def __init__(self, session, destdir=None):
Screen.__init__(self, session)
- self["job_progressbar"] = Progress()
- self["job_progresslabel"] = StaticText("")
-
- self["finished"] = Boolean()
+ self.box = HardwareInfo().get_device_name()
+ self.usbmountpoint = "/mnt/usb/"
- self["infolabel"] = StaticText("")
- self["statusbar"] = StaticText(_("Please select .NFI flash image file from medium"))
- self["listlabel"] = StaticText(_("select .NFI flash file")+":")
-
+ self["key_red"] = StaticText()
self["key_green"] = StaticText()
self["key_yellow"] = StaticText()
self["key_blue"] = StaticText()
+ self.filelist = FileList(self.usbmountpoint, matchingPattern = "^.*\.(nfi|NFI)", showDirectories = False, showMountpoints = False)
+ self["filelist"] = self.filelist
+ self["infolabel"] = StaticText()
- self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions"],
+ self["status"] = StaticText(_("Please select an NFI file and press green key to flash!") + '\n' + _("currently installed image: %s") % (about.getImageVersionString()))
+ self.job = None
+
+ self["shortcuts"] = ActionMap(["OkCancelActions", "ColorActions", "ShortcutActions", "DirectionActions"],
{
- "green": self.ok,
+ "ok": self.keyOk,
+ "green": self.keyOk,
+ "up": self.keyUp,
+ "upRepeated": self.keyUp,
+ "downRepeated": self.keyDown,
+ "down": self.keyDown,
+ "left": self.keyLeft,
"yellow": self.reboot,
- "blue": self.runWizard,
- "ok": self.ok,
- "left": self.left,
- "right": self.right,
- "up": self.up,
- "down": self.down
+ "right": self.keyRight
}, -1)
-
- currDir = "/media/usb/"
- self.filelist = FileList(currDir, matchingPattern = "^.*\.(nfi|NFI)")
- self["filelist"] = self.filelist
- self.nfifile = ""
self.md5sum = ""
- self.job = None
- self.box = HardwareInfo().get_device_name()
- self.configuration_restorable = None
- self.wizard_mode = False
- from enigma import eTimer
- self.delayTimer = eTimer()
- self.delayTimer.callback.append(self.runWizard)
- self.delayTimer.start(50,1)
-
- def check_for_wizard(self):
- if self["filelist"].getCurrentDirectory() is not None and fileExists(self["filelist"].getCurrentDirectory()+"wizard.nfo"):
- self["key_blue"].text = _("USB stick wizard")
- return True
- else:
- self["key_blue"].text = ""
- return False
+ self.onShown.append(self.autostart)
- def runWizard(self):
- if not self.check_for_wizard():
- self.wizard_mode = False
- return
- wizardcontent = open(self["filelist"].getCurrentDirectory()+"/wizard.nfo", "r").readlines()
- nfifile = None
- for line in wizardcontent:
- line = line.strip()
- if line.startswith("image: "):
- nfifile = self["filelist"].getCurrentDirectory()+line[7:]
- if line.startswith("configuration: "):
- backupfile = self["filelist"].getCurrentDirectory()+line[15:]
- if fileExists(backupfile):
- print "wizard configuration:", backupfile
- self.configuration_restorable = backupfile
- else:
- self.configuration_restorable = None
- if nfifile and fileExists(nfifile):
- self.wizard_mode = True
- print "wizard image:", nfifile
- self.check_for_NFO(nfifile)
- self.queryFlash()
-
- def closeCB(self):
- if ( self.job is None or self.job.status is not self.job.IN_PROGRESS ) and not self.no_autostart:
- self.close()
- #else:
- #if self.cancelable:
- #self.cancel()
+ def autostart(self):
+ self.onShown.remove(self.autostart)
+ self.check_for_NFO()
+ print "[[layoutFinished]]", len(self["filelist"].getFileList())
+ if len(self["filelist"].getFileList()) == 1:
+ print "==1"
+ self.keyOk()
- def up(self):
+ def keyUp(self):
self["filelist"].up()
self.check_for_NFO()
- def down(self):
+ def keyDown(self):
self["filelist"].down()
self.check_for_NFO()
- def right(self):
+ def keyRight(self):
self["filelist"].pageDown()
self.check_for_NFO()
- def left(self):
+ def keyLeft(self):
self["filelist"].pageUp()
self.check_for_NFO()
+ def keyOk(self):
+ if self.job is None or self.job.status is not self.job.IN_PROGRESS:
+ if self["filelist"].canDescent(): # isDir
+ self["filelist"].descent()
+ self.check_for_NFO()
+ elif self["filelist"].getFilename():
+ self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO)
+
def check_for_NFO(self, nfifile=None):
- self.session.summary.setText(self["filelist"].getFilename())
+ print "check_for_NFO", self["filelist"].getFilename(), self["filelist"].getCurrentDirectory()
+ self["infolabel"].text = ""
+ self["key_green"].text = ""
+
if nfifile is None:
- self.session.summary.setText(self["filelist"].getFilename())
if self["filelist"].getFilename() is None:
return
if self["filelist"].getCurrentDirectory() is not None:
@@ -185,8 +166,10 @@ class NFIFlash(Screen):
if self.nfifile.upper().endswith(".NFI"):
self["key_green"].text = _("Flash")
nfofilename = self.nfifile[0:-3]+"nfo"
+ print nfofilename, fileExists(nfofilename)
if fileExists(nfofilename):
nfocontent = open(nfofilename, "r").read()
+ print "nfocontent:", nfocontent
self["infolabel"].text = nfocontent
pos = nfocontent.find("MD5:")
if pos > 0:
@@ -196,122 +179,51 @@ class NFIFlash(Screen):
else:
self["infolabel"].text = _("No details for this image file") + (self["filelist"].getFilename() or "")
self.md5sum = ""
- else:
- self["infolabel"].text = ""
- self["key_green"].text = ""
-
- def ok(self):
- if self.job is None or self.job.status is not self.job.IN_PROGRESS:
- if self["filelist"].canDescent(): # isDir
- self["filelist"].descent()
- self.session.summary.setText(self["filelist"].getFilename())
- self.check_for_NFO()
- self.check_for_wizard()
- else:
- self.queryFlash()
-
- def queryFlash(self):
- fd = open(self.nfifile, 'r')
- print fd
- sign = fd.read(11)
- print sign
- if sign.find("NFI1" + self.box + "\0") == 0:
- if self.md5sum != "":
- self["statusbar"].text = ("Please wait for md5 signature verification...")
- self.session.summary.setText(("Please wait for md5 signature verification..."))
- self.container = eConsoleAppContainer()
- self.container.setCWD(self["filelist"].getCurrentDirectory())
- self.container.appClosed.append(self.md5finished)
- self.container.dataSent.append(self.md5ready)
- self.container.execute("md5sum -cw -")
- self.container.write(self.md5sum)
- else:
- self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"), MessageBox.TYPE_YESNO)
- else:
- self.session.open(MessageBox, (_("This .NFI file does not contain a valid %s image!") % (self.box.upper())), MessageBox.TYPE_ERROR)
-
- def md5ready(self, retval):
- self.container.sendEOF()
-
- def md5finished(self, retval):
- if retval==0:
- if self.wizard_mode:
- self.session.openWithCallback(self.queryCB, MessageBox, _("Shall the USB stick wizard proceed and program the image file %s into flash memory?" % self.nfifile.rsplit('/',1)[-1]), MessageBox.TYPE_YESNO)
- else:
- self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO)
- else:
- self.session.openWithCallback(self.queryCB, MessageBox, _("The md5sum validation failed, the file may be corrupted! Are you sure that you want to burn this image to flash memory? You are doing this at your own risk!"), MessageBox.TYPE_YESNO)
def queryCB(self, answer):
if answer == True:
self.createJob()
- else:
- self["statusbar"].text = _("Please select .NFI flash image file from medium")
- self.wizard_mode = False
def createJob(self):
self.job = Job("Image flashing job")
- param = [self.nfifile]
- writeNAND(self.job,param,self.box)
- #writeNAND2(self.job,param)
- #writeNAND3(self.job,param)
- self.job.state_changed.append(self.update_job)
- self.job.end = 540
- self.cwd = self["filelist"].getCurrentDirectory()
- self["job_progressbar"].range = self.job.end
- self.startJob()
-
- def startJob(self):
+ self.job.afterEvent = "close"
+ cwd = self["filelist"].getCurrentDirectory()
+ md5verify(self.job, cwd, self.md5sum)
+ writeNAND(self.job, [self.nfifile], self.box)
self["key_blue"].text = ""
self["key_yellow"].text = ""
self["key_green"].text = ""
- #self["progress0"].show()
- #self["progress1"].show()
+ job_manager.AddJob(self.job)
+ self.session.openWithCallback(self.flashed, JobView, self.job, cancelable = False, backgroundable = False, afterEventChangeable = False)
- self.job.start(self.jobcb)
+ def flashed(self, bg):
+ print "[flashed]"
+ if self.job.status == self.job.FINISHED:
+ self["status"].text = _("NFI image flashing completed. Press Yellow to Reboot!")
+ filename = self.usbmountpoint+'enigma2settingsbackup.tar.gz'
+ if fileExists(filename):
+ import os.path, time
+ date = time.ctime(os.path.getmtime(filename))
+ self.session.openWithCallback(self.askRestoreCB, MessageBox, _("The wizard found a configuration backup. Do you want to restore your old settings from %s?") % date, MessageBox.TYPE_YESNO)
+ else:
+ self.unlockRebootButton()
+ else:
+ self["status"].text = _("Flashing failed")
- def update_job(self):
- j = self.job
- #print "[job state_changed]"
- if j.status == j.IN_PROGRESS:
- self.session.summary["job_progressbar"].value = j.progress
- self.session.summary["job_progressbar"].range = j.end
- self.session.summary["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end))
- self["job_progressbar"].range = j.end
- self["job_progressbar"].value = j.progress
- #print "[update_job] j.progress=%f, j.getProgress()=%f, j.end=%d, text=%f" % (j.progress, j.getProgress(), j.end, (100*j.progress/float(j.end)))
- self["job_progresslabel"].text = "%.2f%%" % (100*j.progress/float(j.end))
- self.session.summary.setText(j.tasks[j.current_task].name)
- self["statusbar"].text = (j.tasks[j.current_task].name)
+ def askRestoreCB(self, ret):
+ if ret:
+ from Plugins.SystemPlugins.SoftwareManager.BackupRestore import getBackupFilename
+ restorecmd = ["tar -xzvf " + self.usbmountpoint + getBackupFilename() + " -C /"]
+ self.session.openWithCallback(self.unlockRebootButton, Console, title = _("Restore is running..."), cmdlist = restorecmd, closeOnSuccess = True)
+ else:
+ self.unlockRebootButton()
- elif j.status == j.FINISHED:
- self["statusbar"].text = _("Writing NFI image file to flash completed")
- self.session.summary.setText(_("NFI image flashing completed. Press Yellow to Reboot!"))
- if self.wizard_mode:
- self.restoreConfiguration()
+ def unlockRebootButton(self, retval = None):
+ if self.job.status == self.job.FINISHED:
self["key_yellow"].text = _("Reboot")
- elif j.status == j.FAILED:
- self["statusbar"].text = j.tasks[j.current_task].name + " " + _("failed")
- self.session.open(MessageBox, (_("Flashing failed") + ":\n" + j.tasks[j.current_task].name + ":\n" + j.tasks[j.current_task].output_line), MessageBox.TYPE_ERROR)
-
- def jobcb(self, jobref, fasel, blubber):
- print "[jobcb] %s %s %s" % (jobref, fasel, blubber)
- self["key_green"].text = _("Flash")
-
def reboot(self, ret=None):
if self.job.status == self.job.FINISHED:
- self["statusbar"].text = ("rebooting...")
- TryQuitMainloop(self.session,2)
-
- def restoreConfiguration(self):
- if self.configuration_restorable:
- from Screens.Console import Console
- cmdlist = [ "mount /dev/mtdblock/3 /mnt/realroot -t jffs2", "tar -xzvf " + self.configuration_restorable + " -C /mnt/realroot/" ]
- self.session.open(Console, title = "Restore running", cmdlist = cmdlist, finishedCallback = self.restore_finished, closeOnSuccess = True)
-
- def restore_finished(self):
- self.session.openWithCallback(self.reboot, MessageBox, _("USB stick wizard finished. Your dreambox will now restart with your new image!"), MessageBox.TYPE_INFO)
-
- def createSummary(self):
- return NFISummary
+ self["status"].text = ("rebooting...")
+ from os import system
+ system(eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/NFIFlash/kill_e2_reboot.sh"))
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml
index c81f4ca5..f93f5c5a 100755
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml
+++ b/lib/python/Plugins/SystemPlugins/NFIFlash/meta/plugin_nfiflash.xml
@@ -2,28 +2,18 @@
<prerequisites>
<hardware type="dm8000" />
<tag type="System" />
- <tag type="Software" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>NFIFlash</name>
<packagename>enigma2-plugin-systemplugins-nfiflash</packagename>
- <shortdescription>Restore your Dreambox with a USB stick.</shortdescription>
- <description>With the NFIFlash extension it is possible to prepare a USB stick with an Dreambox image.\n
+ <shortdescription>Restore your Dreambox with a USB stick</shortdescription>
+ <description>With the NFIFlash plugin it is possible to prepare a USB stick with an Dreambox image.\n
It is then possible to flash your Dreambox with the image on that stick.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_nfiflash_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>NFIFlash</name>
- <packagename>enigma2-plugin-systemplugins-nfiflash</packagename>
- <shortdescription>Wiederherstellen Ihrer Dreambox mittels USB-Stick.</shortdescription>
- <description>Mit der NFIFlash Erweiterung können Sie ein Dreambox Image auf einen USB-Stick laden.\
- Mit diesem USB-Stick ist es dann möglich Ihre Dreambox zu flashen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_nfiflash_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-nfiflash" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand b/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand
deleted file mode 100755
index 073a204f..00000000
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/mywritenand
+++ /dev/null
Binary files differ
diff --git a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py
index 28b33305..1eba1dd4 100755
--- a/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/NFIFlash/plugin.py
@@ -2,6 +2,7 @@ from Plugins.Plugin import PluginDescriptor
from Tools.HardwareInfo import HardwareInfo
from Tools.Directories import fileExists
from downloader import NFIDownload, filescan
+from flasher import NFIFlash
def NFIFlasherMain(session, tmp = None, **kwargs):
session.open(NFIDownload, "/home/root" )
@@ -13,16 +14,12 @@ def Plugins(**kwargs):
# currently only available for DM8000
if HardwareInfo().get_device_name() != "dm8000":
return [PluginDescriptor()]
- if fileExists("/usr/share/bootlogo-flasher.mvi"):
- import flasher
- # started from usb stick # don't try to be intelligent and trick this - it's not possible to rewrite the flash memory with a system currently booted from it
- return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,flasher.NFIFlash))]
- else:
- # started on real enigma2
- return [PluginDescriptor(name=_("NFI Image Flashing"),
- description=_("Download .NFI-Files for USB-Flasher"),
- icon = "flash.png",
- where = PluginDescriptor.WHERE_SOFTWAREMANAGER,
- fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"),
- "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}),
- PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)]
+ #return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,NFIFlash))]
+ # it's not possible to rewrite the flash memory with a system currently booted from it
+ return [PluginDescriptor(name=_("NFI Image Flashing"),
+ description=_("Download .NFI-Files for USB-Flasher"),
+ icon = "flash.png",
+ where = PluginDescriptor.WHERE_SOFTWAREMANAGER,
+ fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"),
+ "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}),
+ PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)]
diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
index 6096ca8b..d7e83072 100755
--- a/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
+++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/NetworkWizard.py
@@ -257,7 +257,7 @@ class NetworkWizard(WizardLanguage, Rc):
text1 = _("Your Dreambox is now ready to use.\n\nYour internet connection is working now.\n\n")
text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["acesspoint"]) + "\n"
text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\n"
- text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+"%" + "\n"
+ text4 = _('Link Quality:') + "\t" + str(status[self.selectedInterface]["quality"])+ "\n"
text5 = _('Signal Strength:') + "\t" + str(status[self.selectedInterface]["signal"]) + "\n"
text6 = _('Bitrate:') + "\t" + str(status[self.selectedInterface]["bitrate"]) + "\n"
text7 = _('Encryption:') + " " + str(status[self.selectedInterface]["encryption"]) + "\n"
@@ -421,3 +421,4 @@ class NetworkWizard(WizardLanguage, Rc):
def ChoicesSelectionMoved(self):
pass
+
diff --git a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml
index 4d3adcbd..423365f1 100755
--- a/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml
+++ b/lib/python/Plugins/SystemPlugins/NetworkWizard/meta/plugin_networkwizard.xml
@@ -1,26 +1,18 @@
<default>
<prerequisites>
+ <tag type="Network" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>NetworkWizard</name>
<packagename>enigma2-plugin-systemplugins-networkwizard</packagename>
<shortdescription>Step by step network configuration</shortdescription>
- <description>With the NetworkWizard you can easy configure your network step by step.
+ <description>With the NetworkWizard you can easily configure your network step by step.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_networkwizard_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>NetzwerkWizard</name>
- <packagename>enigma2-plugin-systemplugins-networkwizard</packagename>
- <shortdescription>Schritt für Schritt Netzwerk konfiguration</shortdescription>
- <description>Mit dem NetzwerkWizard können Sie Ihr Netzwerk konfigurieren. Sie werden Schritt
- für Schritt durch die Konfiguration geleitet.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_networkwizard_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-networkwizard" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml
index 2cb47c07..5e1db7ba 100755
--- a/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml
+++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/meta/plugin_positionersetup.xml
@@ -3,25 +3,16 @@
<tag type="SAT" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>PositionerSetup</name>
<packagename>enigma2-plugin-systemplugins-positionersetup</packagename>
- <shortdescription>PositionerSetup helps you installing a motorized dish.</shortdescription>
- <description>With the PositionerSetup extension it is easy to install and configure a motorized dish.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_positionersetup.jpg" />
- </info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>PositionerSetup</name>
- <packagename>enigma2-plugin-systemplugins-positionersetup</packagename>
- <shortdescription>Unterstützt Sie beim installieren eines Rotors.</shortdescription>
- <description>Die PositionerSetup Erweiterung unterstützt Sie beim einrichten
- und konfigurieren einer motorgesteuerten Satellitenantenne.
+ <shortdescription>PositionerSetup helps you installing a motorized dish</shortdescription>
+ <description>With the PositionerSetup plugin it is easy to install and configure a motorized dish.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_positionersetup.jpg" />
</info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-positionersetup" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml
index 4c0c7af7..904f9a2e 100755
--- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml
+++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/meta/plugin_satelliteequipmentcontrol.xml
@@ -3,25 +3,17 @@
<tag type="SAT" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>SatelliteEquipmentControl</name>
<name_de>SatelliteEquipmentControl</name_de>
<packagename>enigma2-plugin-systemplugins-satelliteequipmentcontrol</packagename>
- <shortdescription>SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings.</shortdescription>
- <description>With the SatelliteEquipmentControl extension it is possible to fine-tune DiSEqC-settings.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_satcontrol.jpg" />
- </info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>SatelliteEquipmentControl</name>
- <packagename>enigma2-plugin-systemplugins-satelliteequipmentcontrol</packagename>
- <shortdescription>Fein-Einstellungen für DiSEqC</shortdescription>
- <description>Die SatelliteEquipmentControl-Erweiterung unterstützt Sie beim Feintuning der DiSEqC Einstellungen.
+ <shortdescription>SatelliteEquipmentControl allows you to fine-tune DiSEqC-settings</shortdescription>
+ <description>With the SatelliteEquipmentControl plugin it is possible to fine-tune DiSEqC-settings.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_satcontrol.jpg" />
</info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-satelliteequipmentcontrol" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml b/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml
index e9453deb..fe0c901e 100755
--- a/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml
+++ b/lib/python/Plugins/SystemPlugins/Satfinder/meta/plugin_satfinder.xml
@@ -1,28 +1,18 @@
<default>
<prerequisites>
<tag type="SAT" />
- <tag type="Software" />
+ <tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>Satfinder</name>
<packagename>enigma2-plugin-systemplugins-satfinder</packagename>
- <shortdescription>Satfinder helps you to align your dish.</shortdescription>
- <description>The Satfinder extension helps you to align your dish.\n
+ <shortdescription>Satfinder helps you to align your dish</shortdescription>
+ <description>The Satfinder plugin helps you to align your dish.\n
It shows you informations about signal rate and errors.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_satfinder.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>Satfinder</name>
- <packagename>enigma2-plugin-systemplugins-satfinder</packagename>
- <shortdescription>Satfinder unterstützt Sie beim ausrichten ihrer Satellitenanlage.</shortdescription>
- <description>Die Satfinder-Erweiterung unterstützt Sie beim Ausrichten ihrer Satellitenanlage.\n
- Es zeigt Ihnen Daten wie Signalstärke und Fehlerrate an.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_satfinder.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-satfinder" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml
index 717f732b..73544a56 100755
--- a/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml
+++ b/lib/python/Plugins/SystemPlugins/SkinSelector/meta/plugin_skinselector.xml
@@ -1,28 +1,19 @@
<default>
<prerequisites>
<tag type="Display" />
- <tag type="System" />
+ <tag type="Skin" />
</prerequisites>
<info language="en">
<author>Dream Multimedia</author>
<name>SkinSelector</name>
<packagename>enigma2-plugin-systemplugins-skinselector</packagename>
- <shortdescription>SkinSelector shows a menu with selectable skins.</shortdescription>
+ <shortdescription>SkinSelector shows a menu with selectable skins</shortdescription>
<description>The SkinSelector shows a menu with selectable skins.\n
It's now easy to change the look and feel of your Dreambox.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_skinselector_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>SkinSelector</name>
- <packagename>enigma2-plugin-systemplugins-skinselector</packagename>
- <shortdescription>Der SkinSelector zeigt Ihnen ein Menu mit auswählbaren Skins.</shortdescription>
- <description>Die SkinSelector Erweiterung zeigt Ihnen ein Menu mit auswählbaren Skins.\n
- Sie können nun einfach das Aussehen der grafischen Oberfläche Ihrer Dreambox verändern.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_skinselector_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-skinselector" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
index 997b9571..30cbb6b6 100755
--- a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py
@@ -12,12 +12,13 @@ from Plugins.Plugin import PluginDescriptor
from Components.config import config
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
from os import path, walk
+from enigma import eEnv
class SkinSelector(Screen):
# for i18n:
# _("Choose your Skin")
skinlist = []
- root = "/usr/share/enigma2/"
+ root = eEnv.resolve("${datadir}/enigma2/")
def __init__(self, session, args = None):
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
index dcff3ca2..01649bb3 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py
@@ -11,7 +11,7 @@ from Components.config import config
from Components.ConfigList import ConfigList,ConfigListScreen
from Components.FileList import MultiFileSelectList
from Plugins.Plugin import PluginDescriptor
-from enigma import eTimer
+from enigma import eTimer, eEnv
from Tools.Directories import *
from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
from time import gmtime, strftime, localtime
@@ -20,7 +20,7 @@ from datetime import date
config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
-config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
def getBackupPath():
backuppath = config.plugins.configurationbackup.backuplocation.value
@@ -251,8 +251,9 @@ class RestoreMenu(Screen):
def KeyOk(self):
if (self.exe == False) and (self.entry == True):
self.sel = self["filelist"].getCurrent()
- self.val = self.path + "/" + self.sel
- self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!"))
+ if self.sel:
+ self.val = self.path + "/" + self.sel
+ self.session.openWithCallback(self.startRestore, MessageBox, _("Are you sure you want to restore\nfollowing backup:\n") + self.sel + _("\nSystem will restart after the restore!"))
def keyCancel(self):
self.close()
@@ -265,8 +266,9 @@ class RestoreMenu(Screen):
def deleteFile(self):
if (self.exe == False) and (self.entry == True):
self.sel = self["filelist"].getCurrent()
- self.val = self.path + "/" + self.sel
- self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel ))
+ if self.sel:
+ self.val = self.path + "/" + self.sel
+ self.session.openWithCallback(self.startDelete, MessageBox, _("Are you sure you want to delete\nfollowing backup:\n" + self.sel ))
def startDelete(self, ret = False):
if (ret == True):
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
index 1797e4fe..32d7140a 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
@@ -9,13 +9,14 @@ from Plugins.Plugin import PluginDescriptor
from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
+from enigma import eEnv
from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigBoolean
from Components.Harddisk import harddiskmanager
config.misc.firstrun = ConfigBoolean(default = True)
config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
-config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
backupfile = "enigma2settingsbackup.tar.gz"
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py
index d4653cca..ee0bec74 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py
@@ -1,4 +1,5 @@
-from enigma import eConsoleAppContainer
+# -*- coding: iso-8859-1 -*-
+from enigma import eConsoleAppContainer,eTPM
from Components.Console import Console
from Components.About import about
from Components.DreamInfoHandler import DreamInfoHandler
@@ -8,8 +9,49 @@ from Components.Ipkg import IpkgComponent
from Components.Network import iNetwork
from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR
from Tools.HardwareInfo import HardwareInfo
+import sha
from time import time
+rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+
+def bin2long(s):
+ return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+ res = ""
+ for byte in range(128):
+ res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+ return res
+
+def rsa_pub1024(src, mod):
+ return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+
+def decrypt_block(src, mod):
+ if len(src) != 128 and len(src) != 202:
+ return None
+ dest = rsa_pub1024(src[:128], mod)
+ hash = sha.new(dest[1:107])
+ if len(src) == 202:
+ hash.update(src[131:192])
+ result = hash.digest()
+ if result == dest[107:127]:
+ return dest
+ return None
+
+def validate_cert(cert, key):
+ buf = decrypt_block(cert[8:], key)
+ if buf is None:
+ return None
+ return buf[36:107] + cert[139:196]
+
+def read_random():
+ try:
+ fd = open("/dev/urandom", "r")
+ buf = fd.read(8)
+ fd.close()
+ return buf
+ except:
+ return None
class SoftwareTools(DreamInfoHandler):
lastDownloadDate = None
@@ -28,7 +70,7 @@ class SoftwareTools(DreamInfoHandler):
else:
self.ImageVersion = 'Stable'
self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
- DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion, language = self.language)
+ DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, neededTag = 'ALL_TAGS', neededFlag = self.ImageVersion)
self.directory = resolveFilename(SCOPE_METADIR)
self.hardware_info = HardwareInfo()
self.list = List([])
@@ -51,47 +93,116 @@ class SoftwareTools(DreamInfoHandler):
def checkNetworkCB(self,data):
if data is not None:
if data <= 2:
- SoftwareTools.NetworkConnectionAvailable = True
+ self.NetworkConnectionAvailable = True
self.getUpdates()
else:
- SoftwareTools.NetworkConnectionAvailable = False
+ self.NetworkConnectionAvailable = False
self.getUpdates()
def getUpdates(self, callback = None):
- if SoftwareTools.NetworkConnectionAvailable == True:
- SoftwareTools.lastDownloadDate = time()
- if SoftwareTools.list_updating is False and callback is None:
- SoftwareTools.list_updating = True
- self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
- elif SoftwareTools.list_updating is False and callback is not None:
- SoftwareTools.list_updating = True
- self.NotifierCallback = callback
- self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
- elif SoftwareTools.list_updating is True and callback is not None:
- #update info collecting already in progress
- self.NotifierCallback = callback
+ if self.lastDownloadDate is None:
+ if self.hardware_info.device_name != "dm7025":
+ etpm = eTPM()
+ l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+ if l2cert is None:
+ return
+ l2key = validate_cert(l2cert, rootkey)
+ if l2key is None:
+ return
+ l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+ if l3cert is None:
+ return
+ l3key = validate_cert(l3cert, l2key)
+ if l3key is None:
+ return
+ rnd = read_random()
+ if rnd is None:
+ return
+ val = etpm.challenge(rnd)
+ result = decrypt_block(val, l3key)
+ if self.hardware_info.device_name == "dm7025" or result[80:88] == rnd:
+ if self.NetworkConnectionAvailable == True:
+ self.lastDownloadDate = time()
+ if self.list_updating is False and callback is None:
+ self.list_updating = True
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+ elif self.list_updating is False and callback is not None:
+ self.list_updating = True
+ self.NotifierCallback = callback
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+ elif self.list_updating is True and callback is not None:
+ self.NotifierCallback = callback
+ else:
+ self.list_updating = False
+ if callback is not None:
+ callback(False)
+ elif self.NotifierCallback is not None:
+ self.NotifierCallback(False)
+ else:
+ self.NetworkConnectionAvailable = False
+ self.list_updating = False
+ if callback is not None:
+ callback(False)
+ elif self.NotifierCallback is not None:
+ self.NotifierCallback(False)
else:
- SoftwareTools.list_updating = False
- if callback is not None:
- callback(False)
- elif self.NotifierCallback is not None:
- self.NotifierCallback(False)
+ if self.NetworkConnectionAvailable == True:
+ self.lastDownloadDate = time()
+ if self.list_updating is False and callback is None:
+ self.list_updating = True
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+ elif self.list_updating is False and callback is not None:
+ self.list_updating = True
+ self.NotifierCallback = callback
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+ elif self.list_updating is True and callback is not None:
+ self.NotifierCallback = callback
+ else:
+ if self.list_updating and callback is not None:
+ if self.hardware_info.device_name != "dm7025":
+ etpm = eTPM()
+ l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+ if l2cert is None:
+ return
+ l2key = validate_cert(l2cert, rootkey)
+ if l2key is None:
+ return
+ l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+ if l3cert is None:
+ return
+ l3key = validate_cert(l3cert, l2key)
+ if l3key is None:
+ return
+ rnd = read_random()
+ if rnd is None:
+ return
+ val = etpm.challenge(rnd)
+ result = decrypt_block(val, l3key)
+ if self.hardware_info.device_name == "dm7025" or result[80:88] == rnd:
+ self.NotifierCallback = callback
+ self.startIpkgListAvailable()
+ else:
+ self.list_updating = False
+ if callback is not None:
+ callback(False)
+ elif self.NotifierCallback is not None:
+ self.NotifierCallback(False)
def ipkgCallback(self, event, param):
if event == IpkgComponent.EVENT_ERROR:
- SoftwareTools.list_updating = False
+ self.list_updating = False
if self.NotifierCallback is not None:
self.NotifierCallback(False)
elif event == IpkgComponent.EVENT_DONE:
- if SoftwareTools.list_updating:
+ if self.list_updating:
self.startIpkgListAvailable()
#print event, "-", param
pass
def startIpkgListAvailable(self, callback = None):
if callback is not None:
- SoftwareTools.list_updating = True
- if SoftwareTools.list_updating:
+ self.list_updating = True
+ if self.list_updating:
if not self.UpdateConsole:
self.UpdateConsole = Console()
cmd = "ipkg list"
@@ -100,8 +211,8 @@ class SoftwareTools(DreamInfoHandler):
def IpkgListAvailableCB(self, result, retval, extra_args = None):
(callback) = extra_args
if result:
- if SoftwareTools.list_updating:
- SoftwareTools.available_packetlist = []
+ if self.list_updating:
+ self.available_packetlist = []
for x in result.splitlines():
tokens = x.split(' - ')
name = tokens[0].strip()
@@ -109,7 +220,7 @@ class SoftwareTools(DreamInfoHandler):
l = len(tokens)
version = l > 1 and tokens[1].strip() or ""
descr = l > 2 and tokens[2].strip() or ""
- SoftwareTools.available_packetlist.append([name, version, descr])
+ self.available_packetlist.append([name, version, descr])
if callback is None:
self.startInstallMetaPackage()
else:
@@ -117,7 +228,7 @@ class SoftwareTools(DreamInfoHandler):
if len(self.UpdateConsole.appContainers) == 0:
callback(True)
else:
- SoftwareTools.list_updating = False
+ self.list_updating = False
if self.UpdateConsole:
if len(self.UpdateConsole.appContainers) == 0:
if callback is not None:
@@ -125,14 +236,17 @@ class SoftwareTools(DreamInfoHandler):
def startInstallMetaPackage(self, callback = None):
if callback is not None:
- SoftwareTools.list_updating = True
- if SoftwareTools.list_updating:
- if not self.UpdateConsole:
- self.UpdateConsole = Console()
- cmd = "ipkg install enigma2-meta enigma2-plugins-meta enigma2-skins-meta"
- self.UpdateConsole.ePopen(cmd, self.InstallMetaPackageCB, callback)
+ self.list_updating = True
+ if self.list_updating:
+ if self.NetworkConnectionAvailable == True:
+ if not self.UpdateConsole:
+ self.UpdateConsole = Console()
+ cmd = "ipkg install enigma2-meta enigma2-plugins-meta enigma2-skins-meta"
+ self.UpdateConsole.ePopen(cmd, self.InstallMetaPackageCB, callback)
+ else:
+ self.InstallMetaPackageCB(True)
- def InstallMetaPackageCB(self, result, retval, extra_args = None):
+ def InstallMetaPackageCB(self, result, retval = None, extra_args = None):
(callback) = extra_args
if result:
self.fillPackagesIndexList()
@@ -143,16 +257,17 @@ class SoftwareTools(DreamInfoHandler):
if len(self.UpdateConsole.appContainers) == 0:
callback(True)
else:
- SoftwareTools.list_updating = False
+ self.list_updating = False
if self.UpdateConsole:
if len(self.UpdateConsole.appContainers) == 0:
if callback is not None:
callback(False)
def startIpkgListInstalled(self, callback = None):
+ print "STARTIPKGLISTINSTALLED"
if callback is not None:
- SoftwareTools.list_updating = True
- if SoftwareTools.list_updating:
+ self.list_updating = True
+ if self.list_updating:
if not self.UpdateConsole:
self.UpdateConsole = Console()
cmd = "ipkg list_installed"
@@ -161,14 +276,14 @@ class SoftwareTools(DreamInfoHandler):
def IpkgListInstalledCB(self, result, retval, extra_args = None):
(callback) = extra_args
if result:
- SoftwareTools.installed_packetlist = {}
+ self.installed_packetlist = {}
for x in result.splitlines():
tokens = x.split(' - ')
name = tokens[0].strip()
if not any(name.endswith(x) for x in self.unwanted_extensions):
l = len(tokens)
version = l > 1 and tokens[1].strip() or ""
- SoftwareTools.installed_packetlist[name] = version
+ self.installed_packetlist[name] = version
for package in self.packagesIndexlist[:]:
if not self.verifyPrerequisites(package[0]["prerequisites"]):
self.packagesIndexlist.remove(package)
@@ -184,26 +299,26 @@ class SoftwareTools(DreamInfoHandler):
if len(self.UpdateConsole.appContainers) == 0:
callback(True)
else:
- SoftwareTools.list_updating = False
+ self.list_updating = False
if self.UpdateConsole:
if len(self.UpdateConsole.appContainers) == 0:
if callback is not None:
callback(False)
def countUpdates(self, callback = None):
- SoftwareTools.available_updates = 0
- SoftwareTools.available_updatelist = []
+ self.available_updates = 0
+ self.available_updatelist = []
for package in self.packagesIndexlist[:]:
attributes = package[0]["attributes"]
packagename = attributes["packagename"]
- for x in SoftwareTools.available_packetlist:
+ for x in self.available_packetlist:
if x[0] == packagename:
- if SoftwareTools.installed_packetlist.has_key(packagename):
- if SoftwareTools.installed_packetlist[packagename] != x[1]:
- SoftwareTools.available_updates +=1
- SoftwareTools.available_updatelist.append([packagename])
+ if self.installed_packetlist.has_key(packagename):
+ if self.installed_packetlist[packagename] != x[1]:
+ self.available_updates +=1
+ self.available_updatelist.append([packagename])
- SoftwareTools.list_updating = False
+ self.list_updating = False
if self.UpdateConsole:
if len(self.UpdateConsole.appContainers) == 0:
if callback is not None:
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml
index cd425c33..4135a212 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/meta/plugin_softwaremanager.xml
@@ -3,27 +3,17 @@
<tag type="Software" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>SoftwareManager</name>
<packagename>enigma2-plugin-systemplugins-softwaremanager</packagename>
- <shortdescription>SoftwareManager manages your Dreambox software.</shortdescription>
+ <shortdescription>SoftwareManager manages your Dreambox software</shortdescription>
<description>The SoftwareManager manages your Dreambox software.\n
- It's easy to update your receiver's software, install or remove extensions or even backup and restore your system settings.
+ It's easy to update your receiver's software, install or remove plugins or even backup and restore your system settings.
</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_softwaremanager_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>SoftwareManager</name>
- <packagename>enigma2-plugin-systemplugins-softwaremanager</packagename>
- <shortdescription>Der SoftwareManager verwaltet Ihre Dreambox Software.</shortdescription>
- <description>Der SoftwareManager verwaltet Ihre Dreambox Software.\n
- Sie können nun einfach Ihre Dreambox-Software aktualisieren, neue Erweiterungen installieren oder entfernen,
- oder ihre Einstellungen sichern und wiederherstellen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_softwaremanager_de.jpg" />
- </info>
+
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-softwaremanager" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
index 1e0ed4d5..a6a611d3 100755
--- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
@@ -14,7 +14,8 @@ from Components.MenuList import MenuList
from Components.Sources.List import List
from Components.Slider import Slider
from Components.Harddisk import harddiskmanager
-from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations
+from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigYesNo, ConfigSelection
+from Components.ConfigList import ConfigListScreen
from Components.Console import Console
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
from Components.SelectionList import SelectionList
@@ -26,7 +27,8 @@ from Components.AVSwitch import AVSwitch
from Components.Network import iNetwork
from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR
from Tools.LoadPixmap import LoadPixmap
-from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad
+from Tools.NumericalTextInput import NumericalTextInput
+from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode, eEnv
from cPickle import dump, load
from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK
from time import time, gmtime, strftime, localtime
@@ -41,7 +43,15 @@ from SoftwareTools import iSoftwareTools
config.plugins.configurationbackup = ConfigSubsection()
config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
-config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=[eEnv.resolve('${sysconfdir}/enigma2/'), '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
+
+config.plugins.SoftwareManager = ConfigSubsection()
+config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection(
+ [
+ ("Y", _("Yes, always")),
+ ("N", _("No, never")),
+ ("ask", _("Always ask"))
+ ], "Y")
def write_cache(cache_file, cache_data):
#Does a cPickle dump
@@ -109,13 +119,16 @@ class UpdatePluginMenu(Screen):
self.menu = args
self.list = []
self.oktext = _("\nPress OK on your remote control to continue.")
+ self.menutext = _("Press MENU on your remote control for additional options.")
+ self.infotext = _("Press INFO on your remote control for additional information.")
self.text = ""
self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
if self.menu == 0:
+ print "building menu entries"
self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your Dreambox" ) + self.oktext, None))
self.list.append(("software-update", _("Software update"), _("\nOnline update of your Dreambox software." ) + self.oktext, None))
self.list.append(("software-restore", _("Software restore"), _("\nRestore your Dreambox with a new firmware." ) + self.oktext, None))
- self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext, None))
+ self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your Dreambox settings." ) + self.oktext + "\n\n" + self.infotext, None))
self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your Dreambox settings." ) + self.oktext, None))
self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local extensions and install them." ) + self.oktext, None))
for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER):
@@ -136,7 +149,7 @@ class UpdatePluginMenu(Screen):
elif self.menu == 1:
self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None))
self.list.append(("backuplocation", _("Choose backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None))
- self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None))
+ self.list.append(("backupfiles", _("Choose backup files"), _("Select files for backup.") + self.oktext + "\n\n" + self.infotext, None))
if config.usage.setup_level.index >= 2: # expert+
self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None))
self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None))
@@ -156,25 +169,25 @@ class UpdatePluginMenu(Screen):
self["menu"] = List(self.list)
self["key_red"] = StaticText(_("Close"))
- self["status"] = StaticText("")
+ self["status"] = StaticText(self.menutext)
- self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions"],
+ self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "MenuActions"],
{
"ok": self.go,
"back": self.close,
"red": self.close,
+ "menu": self.handleMenu,
+ "showEventInfo": self.handleInfo,
}, -1)
self.onLayoutFinish.append(self.layoutFinished)
self.backuppath = getBackupPath()
self.backupfile = getBackupFilename()
self.fullbackupfilename = self.backuppath + "/" + self.backupfile
self.onShown.append(self.setWindowTitle)
- #self.onClose.append(self.cleanup)
def layoutFinished(self):
idx = 0
self["menu"].index = idx
- #self.getUpdateInfos()
def setWindowTitle(self):
self.setTitle(_("Software management"))
@@ -201,9 +214,17 @@ class UpdatePluginMenu(Screen):
self.text = _("No network connection available.")
self["status"].setText(self.text)
+ def handleMenu(self):
+ self.session.open(SoftwareManagerSetup)
+
+ def handleInfo(self):
+ current = self["menu"].getCurrent()
+ if current:
+ currentEntry = current[0]
+ if currentEntry in ("system-backup","backupfiles"):
+ self.session.open(SoftwareManagerInfo, mode = "backupinfo")
def go(self):
- #iNetwork.stopPingConsole()
current = self["menu"].getCurrent()
if current:
currentEntry = current[0]
@@ -290,6 +311,185 @@ class UpdatePluginMenu(Screen):
self.exe = True
self.session.open(RestoreScreen, runRestore = True)
+class SoftwareManagerSetup(Screen, ConfigListScreen):
+
+ skin = """
+ <screen name="SoftwareManagerSetup" position="center,center" size="560,440" title="SoftwareManager setup">
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
+ <widget name="config" position="5,50" size="550,350" scrollbarMode="showOnDemand" />
+ <ePixmap pixmap="skin_default/div-h.png" position="0,400" zPosition="1" size="560,2" />
+ <widget source="introduction" render="Label" position="5,410" size="550,30" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+ </screen>"""
+
+ def __init__(self, session, skin_path = None):
+ Screen.__init__(self, session)
+ self.session = session
+ self.skin_path = skin_path
+ if self.skin_path == None:
+ self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager")
+
+ self.onChangedEntry = [ ]
+ self.setup_title = _("Software manager setup")
+ self.overwriteConfigfilesEntry = None
+
+ self.list = [ ]
+ ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry)
+
+ self["actions"] = ActionMap(["SetupActions"],
+ {
+ "cancel": self.keyCancel,
+ "save": self.apply,
+ }, -2)
+
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("OK"))
+ self["key_yellow"] = StaticText()
+ self["key_blue"] = StaticText()
+ self["introduction"] = StaticText()
+
+ self.createSetup()
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ self.setTitle(self.setup_title)
+
+ def createSetup(self):
+ self.list = [ ]
+ self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files ?"), config.plugins.SoftwareManager.overwriteConfigFiles)
+ self.list.append(self.overwriteConfigfilesEntry)
+ self["config"].list = self.list
+ self["config"].l.setSeperation(400)
+ self["config"].l.setList(self.list)
+ if not self.selectionChanged in self["config"].onSelectionChanged:
+ self["config"].onSelectionChanged.append(self.selectionChanged)
+ self.selectionChanged()
+
+ def selectionChanged(self):
+ if self["config"].getCurrent() == self.overwriteConfigfilesEntry:
+ self["introduction"].setText(_("Overwrite configuration files during software upgrade?"))
+ else:
+ self["introduction"].setText("")
+
+ def newConfig(self):
+ pass
+
+ def keyLeft(self):
+ ConfigListScreen.keyLeft(self)
+
+ def keyRight(self):
+ ConfigListScreen.keyRight(self)
+
+ def confirm(self, confirmed):
+ if not confirmed:
+ print "not confirmed"
+ return
+ else:
+ self.keySave()
+
+ def apply(self):
+ self.session.openWithCallback(self.confirm, MessageBox, _("Use this settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True)
+
+ def cancelConfirm(self, result):
+ if not result:
+ return
+ for x in self["config"].list:
+ x[1].cancel()
+ self.close()
+
+ def keyCancel(self):
+ if self["config"].isChanged():
+ self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True)
+ else:
+ self.close()
+
+ # for summary:
+ def changedEntry(self):
+ for x in self.onChangedEntry:
+ x()
+ self.selectionChanged()
+
+ def getCurrentEntry(self):
+ return self["config"].getCurrent()[0]
+
+ def getCurrentValue(self):
+ return str(self["config"].getCurrent()[1].value)
+
+ def createSummary(self):
+ from Screens.Setup import SetupSummary
+ return SetupSummary
+
+
+class SoftwareManagerInfo(Screen):
+ skin = """
+ <screen name="SoftwareManagerInfo" position="center,center" size="560,440" title="SoftwareManager information">
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
+ <widget source="list" render="Listbox" position="5,50" size="550,340" scrollbarMode="showOnDemand" selectionDisabled="0">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (5, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT | RT_HALIGN_CENTER, text = 0), # index 0 is the name
+ ],
+ "fonts": [gFont("Regular", 24),gFont("Regular", 22)],
+ "itemHeight": 26
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/div-h.png" position="0,400" zPosition="1" size="560,2" />
+ <widget source="introduction" render="Label" position="5,410" size="550,30" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+ </screen>"""
+
+ def __init__(self, session, skin_path = None, mode = None):
+ Screen.__init__(self, session)
+ self.session = session
+ self.mode = mode
+ self.skin_path = skin_path
+ if self.skin_path == None:
+ self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager")
+
+ self["actions"] = ActionMap(["ShortcutActions", "WizardActions"],
+ {
+ "back": self.close,
+ "red": self.close,
+ }, -2)
+
+ self.list = []
+ self["list"] = List(self.list)
+
+ self["key_red"] = StaticText(_("Close"))
+ self["key_green"] = StaticText()
+ self["key_yellow"] = StaticText()
+ self["key_blue"] = StaticText()
+ self["introduction"] = StaticText()
+
+ self.onLayoutFinish.append(self.layoutFinished)
+
+ def layoutFinished(self):
+ self.setTitle(_("Softwaremanager information"))
+ if self.mode is not None:
+ self.showInfos()
+
+ def showInfos(self):
+ if self.mode == "backupinfo":
+ self.list = []
+ backupfiles = config.plugins.configurationbackup.backupdirs.value
+ for entry in backupfiles:
+ print entry
+ self.list.append((entry,))
+ self['list'].setList(self.list)
+
class PluginManager(Screen, DreamInfoHandler):
@@ -409,6 +609,7 @@ class PluginManager(Screen, DreamInfoHandler):
statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png"))
self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' ))
elif status == 'error':
+ self["key_green"].setText(_("Continue"))
statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' ))
self["list"].style = "default"
@@ -416,8 +617,11 @@ class PluginManager(Screen, DreamInfoHandler):
def getUpdateInfos(self):
- self.setState('update')
- iSoftwareTools.startSoftwareTools(self.getUpdateInfosCB)
+ if (iSoftwareTools.lastDownloadDate is not None and iSoftwareTools.NetworkConnectionAvailable is False):
+ self.rebuildList()
+ else:
+ self.setState('update')
+ iSoftwareTools.startSoftwareTools(self.getUpdateInfosCB)
def getUpdateInfosCB(self, retval = None):
if retval is not None:
@@ -428,11 +632,17 @@ class PluginManager(Screen, DreamInfoHandler):
self["status"].setText(_("There are no updates available."))
self.rebuildList()
elif retval is False:
- self.setState('error')
- if iSoftwareTools.NetworkConnectionAvailable:
- self["status"].setText(_("Updatefeed not available."))
+ if iSoftwareTools.lastDownloadDate is None:
+ self.setState('error')
+ if iSoftwareTools.NetworkConnectionAvailable:
+ self["status"].setText(_("Updatefeed not available."))
+ else:
+ self["status"].setText(_("No network connection available."))
else:
- self["status"].setText(_("No network connection available."))
+ iSoftwareTools.lastDownloadDate = time()
+ iSoftwareTools.list_updating = True
+ self.setState('update')
+ iSoftwareTools.getUpdates(self.getUpdateInfosCB)
def rebuildList(self, retval = None):
if self.currentSelectedTag is None:
@@ -450,10 +660,14 @@ class PluginManager(Screen, DreamInfoHandler):
self["key_green"].setText(_("Uninstall"))
elif current[4] == 'installable':
self["key_green"].setText(_("Install"))
+ if iSoftwareTools.NetworkConnectionAvailable is False:
+ self["key_green"].setText("")
elif current[4] == 'remove':
self["key_green"].setText(_("Undo uninstall"))
elif current[4] == 'install':
self["key_green"].setText(_("Undo install"))
+ if iSoftwareTools.NetworkConnectionAvailable is False:
+ self["key_green"].setText("")
self["key_yellow"].setText(_("View details"))
self["key_blue"].setText("")
if len(self.selectedFiles) == 0 and iSoftwareTools.available_updates is not 0:
@@ -503,21 +717,31 @@ class PluginManager(Screen, DreamInfoHandler):
if entry[0] == detailsFile:
alreadyinList = True
if not alreadyinList:
- self.selectedFiles.append((detailsFile,current[4],current[3]))
- self.currentSelectedPackage = ((detailsFile,current[4],current[3]))
+ if (iSoftwareTools.NetworkConnectionAvailable is False and current[4] in ('installable','install')):
+ pass
+ else:
+ self.selectedFiles.append((detailsFile,current[4],current[3]))
+ self.currentSelectedPackage = ((detailsFile,current[4],current[3]))
if current[4] == 'installed':
self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'remove', True)
elif current[4] == 'installable':
- self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True)
+ if iSoftwareTools.NetworkConnectionAvailable:
+ self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True)
elif current[4] == 'remove':
self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installed', False)
elif current[4] == 'install':
- self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False)
+ if iSoftwareTools.NetworkConnectionAvailable:
+ self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False)
self["list"].setList(self.list)
self["list"].setIndex(idx)
self["list"].updateList(self.list)
self.selectionChanged()
-
+ elif self.currList == "status":
+ iSoftwareTools.lastDownloadDate = time()
+ iSoftwareTools.list_updating = True
+ self.setState('update')
+ iSoftwareTools.getUpdates(self.getUpdateInfosCB)
+
def handleSelected(self):
current = self["list"].getCurrent()
if current:
@@ -589,13 +813,13 @@ class PluginManager(Screen, DreamInfoHandler):
status = "remove"
else:
status = "installed"
- self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState))
+ self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState))
else:
if selectState == True:
status = "install"
else:
status = "installable"
- self.list.append(self.buildEntryComponent(name, details, description, packagename, status, selected = selectState))
+ self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState))
if len(self.list):
self.list.sort(key=lambda x: x[0])
self["list"].style = "default"
@@ -904,8 +1128,7 @@ class PluginDetails(Screen, DreamInfoHandler):
self.skin_path = plugin_path
self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
self.attributes = None
- self.translatedAttributes = None
- DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language)
+ DreamInfoHandler.__init__(self, self.statusCallback, blocking = False)
self.directory = resolveFilename(SCOPE_METADIR)
if packagedata:
self.pluginname = packagedata[0]
@@ -943,8 +1166,6 @@ class PluginDetails(Screen, DreamInfoHandler):
self.package = self.packageDetails[0]
if self.package[0].has_key("attributes"):
self.attributes = self.package[0]["attributes"]
- if self.package[0].has_key("translation"):
- self.translatedAttributes = self.package[0]["translation"]
self.cmdList = []
self.oktext = _("\nAfter pressing OK, please wait!")
@@ -954,7 +1175,7 @@ class PluginDetails(Screen, DreamInfoHandler):
self.onLayoutFinish.append(self.setInfos)
def setWindowTitle(self):
- self.setTitle(_("Details for extension: " + self.pluginname))
+ self.setTitle(_("Details for plugin: ") + self.pluginname )
def exit(self):
self.close(False)
@@ -969,36 +1190,31 @@ class PluginDetails(Screen, DreamInfoHandler):
pass
def setInfos(self):
- if self.translatedAttributes.has_key("name"):
- self.pluginname = self.translatedAttributes["name"]
- elif self.attributes.has_key("name"):
+ if self.attributes.has_key("screenshot"):
+ self.loadThumbnail(self.attributes)
+
+ if self.attributes.has_key("name"):
self.pluginname = self.attributes["name"]
else:
self.pluginname = _("unknown")
- if self.translatedAttributes.has_key("author"):
- self.author = self.translatedAttributes["author"]
- elif self.attributes.has_key("author"):
+ if self.attributes.has_key("author"):
self.author = self.attributes["author"]
else:
self.author = _("unknown")
- if self.translatedAttributes.has_key("description"):
- self.description = self.translatedAttributes["description"]
- elif self.attributes.has_key("description"):
- self.description = self.attributes["description"]
+ if self.attributes.has_key("description"):
+ self.description = _(self.attributes["description"].replace("\\n", "\n"))
else:
self.description = _("No description available.")
- if self.translatedAttributes.has_key("screenshot"):
- self.loadThumbnail(self.translatedAttributes)
- else:
- self.loadThumbnail(self.attributes)
-
self["author"].setText(_("Author: ") + self.author)
- self["detailtext"].setText(self.description.strip())
+ self["detailtext"].setText(_(self.description))
if self.pluginstate in ('installable', 'install'):
- self["key_green"].setText(_("Install"))
+ if iSoftwareTools.NetworkConnectionAvailable:
+ self["key_green"].setText(_("Install"))
+ else:
+ self["key_green"].setText("")
else:
self["key_green"].setText(_("Remove"))
@@ -1006,10 +1222,17 @@ class PluginDetails(Screen, DreamInfoHandler):
thumbnailUrl = None
if entry.has_key("screenshot"):
thumbnailUrl = entry["screenshot"]
+ if self.language == "de":
+ if thumbnailUrl[-7:] == "_en.jpg":
+ thumbnailUrl = thumbnailUrl[:-7] + "_de.jpg"
+
if thumbnailUrl is not None:
self.thumbnail = "/tmp/" + thumbnailUrl.split('/')[-1]
print "[PluginDetails] downloading screenshot " + thumbnailUrl + " to " + self.thumbnail
- client.downloadPage(thumbnailUrl,self.thumbnail).addCallback(self.setThumbnail).addErrback(self.fetchFailed)
+ if iSoftwareTools.NetworkConnectionAvailable:
+ client.downloadPage(thumbnailUrl,self.thumbnail).addCallback(self.setThumbnail).addErrback(self.fetchFailed)
+ else:
+ self.setThumbnail(noScreenshot = True)
else:
self.setThumbnail(noScreenshot = True)
@@ -1049,11 +1272,12 @@ class PluginDetails(Screen, DreamInfoHandler):
if len(self.cmdList):
self.session.openWithCallback(self.runRemove, MessageBox, _("Do you want to remove the package:\n") + self.pluginname + "\n" + self.oktext)
else:
- if self.packagefiles:
- for package in self.packagefiles[:]:
- self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] }))
- if len(self.cmdList):
- self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext)
+ if iSoftwareTools.NetworkConnectionAvailable:
+ if self.packagefiles:
+ for package in self.packagefiles[:]:
+ self.cmdList.append((IpkgComponent.CMD_INSTALL, { "package": package["name"] }))
+ if len(self.cmdList):
+ self.session.openWithCallback(self.runUpgrade, MessageBox, _("Do you want to install the package:\n") + self.pluginname + "\n" + self.oktext)
def runUpgrade(self, result):
if result:
@@ -1095,11 +1319,11 @@ class PluginDetails(Screen, DreamInfoHandler):
class UpdatePlugin(Screen):
skin = """
- <screen name="UpdatePlugin" position="center,center" size="550,200" title="Software update" >
+ <screen name="UpdatePlugin" position="center,center" size="550,300" title="Software update" >
<widget name="activityslider" position="0,0" size="550,5" />
<widget name="slider" position="0,150" size="550,30" />
<widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
- <widget source="status" render="Label" position="10,60" size="540,45" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+ <widget source="status" render="Label" position="10,180" size="540,100" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
</screen>"""
def __init__(self, session, args = None):
@@ -1111,31 +1335,48 @@ class UpdatePlugin(Screen):
self["slider"] = self.slider
self.activityslider = Slider(0, 100)
self["activityslider"] = self.activityslider
- self.status = StaticText(_("Upgrading Dreambox... Please wait"))
+ self.status = StaticText(_("Please wait..."))
self["status"] = self.status
- self.package = StaticText()
+ self.package = StaticText(_("Verifying your internet connection..."))
self["package"] = self.package
+ self.oktext = _("Press OK on your remote control to continue.")
self.packages = 0
self.error = 0
+ self.processed_packages = []
self.activity = 0
self.activityTimer = eTimer()
self.activityTimer.callback.append(self.doActivityTimer)
- self.activityTimer.start(100, False)
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
- self.updating = True
- self.package.setText(_("Package list update"))
- self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+ self.updating = False
self["actions"] = ActionMap(["WizardActions"],
{
"ok": self.exit,
"back": self.exit
}, -1)
+
+ iNetwork.checkNetworkState(self.checkNetworkCB)
+ self.onClose.append(self.cleanup)
+
+ def cleanup(self):
+ iNetwork.stopPingConsole()
+
+ def checkNetworkCB(self,data):
+ if data is not None:
+ if data <= 2:
+ self.updating = True
+ self.activityTimer.start(100, False)
+ self.package.setText(_("Package list update"))
+ self.status.setText(_("Upgrading Dreambox... Please wait"))
+ self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+ else:
+ self.package.setText(_("Your network is not working. Please try again."))
+ self.status.setText(self.oktext)
def doActivityTimer(self):
self.activity += 1
@@ -1151,20 +1392,34 @@ class UpdatePlugin(Screen):
self.slider.setValue(self.sliderPackages[param])
self.package.setText(param)
self.status.setText(_("Upgrading"))
- self.packages += 1
+ if not param in self.processed_packages:
+ self.processed_packages.append(param)
+ self.packages += 1
elif event == IpkgComponent.EVENT_INSTALL:
self.package.setText(param)
self.status.setText(_("Installing"))
- self.packages += 1
+ if not param in self.processed_packages:
+ self.processed_packages.append(param)
+ self.packages += 1
+ elif event == IpkgComponent.EVENT_REMOVE:
+ self.package.setText(param)
+ self.status.setText(_("Removing"))
+ if not param in self.processed_packages:
+ self.processed_packages.append(param)
+ self.packages += 1
elif event == IpkgComponent.EVENT_CONFIGURING:
self.package.setText(param)
self.status.setText(_("Configuring"))
+
elif event == IpkgComponent.EVENT_MODIFIED:
- self.session.openWithCallback(
- self.modificationCallback,
- MessageBox,
- _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
- )
+ if config.plugins.SoftwareManager.overwriteConfigFiles.value in ("N", "Y"):
+ self.ipkg.write(True and config.plugins.SoftwareManager.overwriteConfigFiles.value)
+ else:
+ self.session.openWithCallback(
+ self.modificationCallback,
+ MessageBox,
+ _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
+ )
elif event == IpkgComponent.EVENT_ERROR:
self.error += 1
elif event == IpkgComponent.EVENT_DONE:
@@ -1177,8 +1432,8 @@ class UpdatePlugin(Screen):
self.activityTimer.stop()
self.activityslider.setValue(0)
- self.package.setText("")
- self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages)
+ self.package.setText(_("Done - Installed or upgraded %d packages") % self.packages)
+ self.status.setText(self.oktext)
else:
self.activityTimer.stop()
self.activityslider.setValue(0)
@@ -1200,6 +1455,9 @@ class UpdatePlugin(Screen):
self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your Dreambox?"))
else:
self.close()
+ else:
+ if not self.updating:
+ self.close()
def exitAnswer(self, result):
if result is not None and result:
@@ -1381,7 +1639,7 @@ class IPKGSource(Screen):
self["text"].number(number)
-class PacketManager(Screen):
+class PacketManager(Screen, NumericalTextInput):
skin = """
<screen name="PacketManager" position="center,center" size="530,420" title="Packet manager" >
<ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
@@ -1405,15 +1663,29 @@ class PacketManager(Screen):
def __init__(self, session, plugin_path, args = None):
Screen.__init__(self, session)
+ NumericalTextInput.__init__(self)
self.session = session
self.skin_path = plugin_path
- self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"],
+ self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')
+
+ self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions", "NumberActions", "InputActions", "InputAsciiActions", "KeyboardInputActions" ],
{
"ok": self.go,
"back": self.exit,
"red": self.exit,
"green": self.reload,
+ "gotAsciiCode": self.keyGotAscii,
+ "1": self.keyNumberGlobal,
+ "2": self.keyNumberGlobal,
+ "3": self.keyNumberGlobal,
+ "4": self.keyNumberGlobal,
+ "5": self.keyNumberGlobal,
+ "6": self.keyNumberGlobal,
+ "7": self.keyNumberGlobal,
+ "8": self.keyNumberGlobal,
+ "9": self.keyNumberGlobal,
+ "0": self.keyNumberGlobal
}, -1)
self.list = []
@@ -1425,25 +1697,59 @@ class PacketManager(Screen):
self.list_updating = True
self.packetlist = []
self.installed_packetlist = {}
+ self.upgradeable_packages = {}
self.Console = Console()
self.cmdList = []
self.cachelist = []
self.cache_ttl = 86400 #600 is default, 0 disables, Seconds cache is considered valid (24h should be ok for caching ipkgs)
- self.cache_file = '/usr/lib/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache' #Path to cache directory
+ self.cache_file = eEnv.resolve('${libdir}/enigma2/python/Plugins/SystemPlugins/SoftwareManager/packetmanager.cache') #Path to cache directory
self.oktext = _("\nAfter pressing OK, please wait!")
self.unwanted_extensions = ('-dbg', '-dev', '-doc', 'busybox')
+ self.opkgAvail = fileExists('/usr/bin/opkg')
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
self.onShown.append(self.setWindowTitle)
self.onLayoutFinish.append(self.rebuildList)
+ rcinput = eRCInput.getInstance()
+ rcinput.setKeyboardMode(rcinput.kmAscii)
+
+ def keyNumberGlobal(self, val):
+ key = self.getKey(val)
+ if key is not None:
+ keyvalue = key.encode("utf-8")
+ if len(keyvalue) == 1:
+ self.setNextIdx(keyvalue[0])
+
+ def keyGotAscii(self):
+ keyvalue = unichr(getPrevAsciiCode()).encode("utf-8")
+ if len(keyvalue) == 1:
+ self.setNextIdx(keyvalue[0])
+
+ def setNextIdx(self,char):
+ if char in ("0", "1", "a"):
+ self["list"].setIndex(0)
+ else:
+ idx = self.getNextIdx(char)
+ if idx and idx <= self["list"].count:
+ self["list"].setIndex(idx)
+
+ def getNextIdx(self,char):
+ idx = 0
+ for i in self["list"].list:
+ if i[0][0] == char:
+ return idx
+ idx += 1
+
def exit(self):
self.ipkg.stop()
if self.Console is not None:
if len(self.Console.appContainers):
for name in self.Console.appContainers.keys():
self.Console.kill(name)
+ rcinput = eRCInput.getInstance()
+ rcinput.setKeyboardMode(rcinput.kmNone)
self.close()
def reload(self):
@@ -1561,14 +1867,19 @@ class PacketManager(Screen):
def IpkgList_Finished(self, result, retval, extra_args = None):
if result:
self.packetlist = []
+ last_name = ""
for x in result.splitlines():
- tokens = x.split(' - ') #self.blacklisted_packages
+ tokens = x.split(' - ')
name = tokens[0].strip()
if not any(name.endswith(x) for x in self.unwanted_extensions):
l = len(tokens)
version = l > 1 and tokens[1].strip() or ""
descr = l > 2 and tokens[2].strip() or ""
+ if name == last_name:
+ continue
+ last_name = name
self.packetlist.append([name, version, descr])
+
if not self.Console:
self.Console = Console()
cmd = "ipkg list_installed"
@@ -1578,30 +1889,47 @@ class PacketManager(Screen):
if result:
self.installed_packetlist = {}
for x in result.splitlines():
- tokens = x.split(' - ') #self.blacklisted_packages
+ tokens = x.split(' - ')
name = tokens[0].strip()
if not any(name.endswith(x) for x in self.unwanted_extensions):
l = len(tokens)
version = l > 1 and tokens[1].strip() or ""
self.installed_packetlist[name] = version
- self.buildPacketList()
+ if self.opkgAvail:
+ if not self.Console:
+ self.Console = Console()
+ cmd = "opkg list-upgradable"
+ self.Console.ePopen(cmd, self.OpkgListUpgradeable_Finished)
+ else:
+ self.buildPacketList()
+ def OpkgListUpgradeable_Finished(self, result, retval, extra_args = None):
+ if result:
+ self.upgradeable_packages = {}
+ for x in result.splitlines():
+ tokens = x.split(' - ')
+ name = tokens[0].strip()
+ if not any(name.endswith(x) for x in self.unwanted_extensions):
+ l = len(tokens)
+ version = l > 2 and tokens[2].strip() or ""
+ self.upgradeable_packages[name] = version
+ self.buildPacketList()
+
def buildEntryComponent(self, name, version, description, state):
divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
if state == 'installed':
installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
- return((name, version, description, state, installedpng, divpng))
+ return((name, version, _(description), state, installedpng, divpng))
elif state == 'upgradeable':
upgradeablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgradeable.png"))
- return((name, version, description, state, upgradeablepng, divpng))
+ return((name, version, _(description), state, upgradeablepng, divpng))
else:
installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png"))
- return((name, version, description, state, installablepng, divpng))
+ return((name, version, _(description), state, installablepng, divpng))
def buildPacketList(self):
self.list = []
self.cachelist = []
-
if self.cache_ttl > 0 and self.vc != 0:
print 'Loading packagelist cache from ',self.cache_file
try:
@@ -1617,24 +1945,28 @@ class PacketManager(Screen):
print 'rebuilding fresh package list'
for x in self.packetlist:
status = ""
- if self.installed_packetlist.has_key(x[0].strip()):
- if self.installed_packetlist[x[0].strip()] == x[1].strip():
- status = "installed"
- self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
+ if self.installed_packetlist.has_key(x[0]):
+ if self.opkgAvail:
+ if self.upgradeable_packages.has_key(x[0]):
+ status = "upgradeable"
+ else:
+ status = "installed"
else:
- status = "upgradeable"
- self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
+ if self.installed_packetlist[x[0]] == x[1]:
+ status = "installed"
+ else:
+ status = "upgradeable"
else:
status = "installable"
- self.list.append(self.buildEntryComponent(x[0].strip(), x[1].strip(), x[2].strip(), status))
- if not any(x[0].strip().endswith(x) for x in self.unwanted_extensions):
- self.cachelist.append([x[0].strip(), x[1].strip(), x[2].strip(), status])
+ self.list.append(self.buildEntryComponent(x[0], x[1], x[2], status))
+ self.cachelist.append([x[0], x[1], x[2], status])
write_cache(self.cache_file, self.cachelist)
self['list'].setList(self.list)
def reloadPluginlist(self):
plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+
class IpkgInstaller(Screen):
skin = """
<screen name="IpkgInstaller" position="center,center" size="550,450" title="Install extensions" >
diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE b/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE
new file mode 100755
index 00000000..99700593
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/TempFanControl/LICENSE
@@ -0,0 +1,12 @@
+This plugin is licensed under the Creative Commons
+Attribution-NonCommercial-ShareAlike 3.0 Unported
+License. To view a copy of this license, visit
+http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative
+Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
+
+Alternatively, this plugin may be distributed and executed on hardware which
+is licensed by Dream Multimedia GmbH.
+
+This plugin is NOT free software. It is open source, you are allowed to
+modify it (if you keep the license), but it may not be commercially
+distributed other than under the conditions noted above.
diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am
index 78ff11c3..490a7720 100644..100755
--- a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am
+++ b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am
@@ -1,5 +1,9 @@
-installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/TempFanControl
+installdir = $(pkglibdir)/python/Plugins/SystemPlugins/TempFanControl
+
+SUBDIRS = meta
install_PYTHON = \
__init__.py \
plugin.py
+
+dist_install_DATA = LICENSE
diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am
new file mode 100755
index 00000000..da7be245
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/Makefile.am
@@ -0,0 +1,3 @@
+installdir = $(datadir)/meta
+
+dist_install_DATA = plugin_tempfancontrol.xml
diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml
new file mode 100755
index 00000000..5c6565a9
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/TempFanControl/meta/plugin_tempfancontrol.xml
@@ -0,0 +1,20 @@
+<default>
+ <prerequisites>
+ <hardware type="dm8000" />
+ <hardware type="dm500hd" />
+ <hardware type="dm800se" />
+ <hardware type="dm7020hd" />
+ <tag type="System" />
+ </prerequisites>
+ <info>
+ <author>Dream Multimedia</author>
+ <name>TempFanControl</name>
+ <packagename>enigma2-plugin-systemplugins-tempfancontrol</packagename>
+ <shortdescription>Control your system fan</shortdescription>
+ <description>Control your internal system fan.</description>
+ </info>
+
+ <files type="package"> <!-- without version, without .ipk -->
+ <file type="package" name="enigma2-plugin-systemplugins-tempfancontrol" />
+ </files>
+</default>
diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py
index c8af9cdd..42fe82da 100644..100755
--- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py
@@ -131,6 +131,7 @@ class TempFanControl(Screen, ConfigListScreen):
ConfigListScreen.__init__(self, self.list, session = self.session)
#self["config"].list = self.list
#self["config"].setList(self.list)
+ self["config"].l.setSeperation(300)
self["actions"] = ActionMap(["OkCancelActions", "ColorActions"],
{
diff --git a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml
index 208c7e0c..f52b4dab 100755
--- a/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml
+++ b/lib/python/Plugins/SystemPlugins/VideoEnhancement/meta/plugin_videoenhancement.xml
@@ -3,25 +3,19 @@
<hardware type="dm8000" />
<hardware type="dm800" />
<hardware type="dm500hd" />
+ <hardware type="dm800se" />
+ <hardware type="dm7020hd" />
<tag type="Display" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>VideoEnhancement</name>
<packagename>enigma2-plugin-systemplugins-videoenhancement</packagename>
- <shortdescription>VideoEnhancement provides advanced video enhancement settings.</shortdescription>
- <description>The VideoEnhancement extension provides advanced video enhancement settings.</description>
+ <shortdescription>VideoEnhancement provides advanced video enhancement settings</shortdescription>
+ <description>The VideoEnhancement plugin provides advanced video enhancement settings.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_videoenhancement_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>Erweiterte A/V Einstellungen</name>
- <packagename>enigma2-plugin-systemplugins-videoenhancement</packagename>
- <shortdescription>Erweiterte A/V Einstellungen für Ihre Dreambox.</shortdescription>
- <description>Erweiterte A/V Einstellungen für Ihre Dreambox.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videoenhancement_de.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-videoenhancement" />
diff --git a/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml b/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml
index c4609433..78b170ac 100755
--- a/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml
+++ b/lib/python/Plugins/SystemPlugins/VideoTune/meta/plugin_videotune.xml
@@ -3,23 +3,14 @@
<tag type="Display" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>VideoTune</name>
<packagename>enigma2-plugin-systemplugins-videotune</packagename>
- <shortdescription>VideoTune helps fine-tuning your tv display.</shortdescription>
+ <shortdescription>VideoTune helps fine-tuning your tv display</shortdescription>
<description>The VideoTune helps fine-tuning your tv display.\nYou can control brightness and contrast of your tv.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_videotune.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia - DE</author>
- <name>VideoTune - DE </name>
- <packagename>enigma2-plugin-systemplugins-videotune</packagename>
- <shortdescription>VideoTune hilft beim fein-einstellen des Fernsehers.</shortdescription>
- <description>VideoTune hilf beim fein-einstellen des Fernsehers.\nSie können Kontrast und Helligkeit fein-einstellen.
- </description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videotune.jpg" />
- </info>
<files type="package"> <!-- ohne versionsnummer, ohne .ipkg -->
<file type="package" name="enigma2-plugin-systemplugins-videotune" />
</files>
diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
index e3b902f0..dc4e8c56 100644
--- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
+++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
@@ -239,9 +239,9 @@ class VideoHardware:
portlist = self.getPortList()
for port in portlist:
descr = port
- if descr == 'DVI' and hw_type == 'dm500hd':
+ if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se', 'dm7020hd'):
descr = 'HDMI'
- elif descr == 'DVI-PC' and hw_type == 'dm500hd':
+ elif descr == 'DVI-PC' and hw_type in ('dm500hd', 'dm800se', 'dm7020hd'):
descr = 'HDMI-PC'
lst.append((port, descr))
diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py
index 15f4d516..18e81764 100644..100755
--- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py
+++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py
@@ -12,14 +12,22 @@ from Tools.HardwareInfo import HardwareInfo
config.misc.showtestcard = ConfigBoolean(default = False)
class VideoWizardSummary(WizardSummary):
- skin = """
- <screen position="0,0" size="132,64">
+ skin = (
+ """<screen name="VideoWizardSummary" position="0,0" size="132,64" id="1">
<widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" />
<widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14">
<convert type="StringListSelection" />
</widget>
<!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/-->
- </screen>""" #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png"))
+ </screen>""",
+ """<screen name="VideoWizardSummary" position="0,0" size="96,64" id="2">
+ <widget name="text" position="0,4" size="96,40" font="Regular;12" transparent="1" />
+ <widget source="parent.list" render="Label" position="0,40" size="96,21" font="Regular;14">
+ <convert type="StringListSelection" />
+ </widget>
+ <!--widget name="pic" pixmap="%s" position="0,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/-->
+ </screen>""")
+ #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png"))
def __init__(self, session, parent):
WizardSummary.__init__(self, session, parent)
@@ -82,7 +90,7 @@ class VideoWizard(WizardLanguage, Rc):
for port in self.hw.getPortList():
if self.hw.isPortUsed(port):
descr = port
- if descr == 'DVI' and hw_type == 'dm500hd':
+ if descr == 'DVI' and hw_type in ('dm500hd', 'dm800se', 'dm7020hd'):
descr = 'HDMI'
if port != "DVI-PC":
list.append((descr,port))
@@ -100,7 +108,7 @@ class VideoWizard(WizardLanguage, Rc):
self.inputSelect(self.selection)
if self["portpic"].instance is not None:
picname = self.selection
- if picname == "DVI" and HardwareInfo().get_device_name() == "dm500hd":
+ if picname == "DVI" and HardwareInfo().get_device_name() in ("dm500hd", "dm800se", "dm7020hd"):
picname = "HDMI"
self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + picname + ".png"))
diff --git a/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml b/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml
index fbb6e3f4..e16a7dc8 100755
--- a/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml
+++ b/lib/python/Plugins/SystemPlugins/Videomode/meta/plugin_videomode.xml
@@ -3,22 +3,14 @@
<tag type="Display" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>Videomode</name>
<packagename>enigma2-plugin-systemplugins-videomode</packagename>
- <shortdescription>Videomode provides advanced video modes.</shortdescription>
- <description>The Videomode extension provides advanced video modes.</description>
+ <shortdescription>Videomode provides advanced video mode settings</shortdescription>
+ <description>The Videomode plugin provides advanced video mode settings.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_videomode_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>Videomode</name>
- <packagename>enigma2-plugin-systemplugins-videomode</packagename>
- <shortdescription>Videomode bietet erweiterte Video Einstellungen.</shortdescription>
- <description>Die Videomode-Erweiterung bietet erweiterte Video-Einstellungen.</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_videomode_de.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-videomode" />
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am b/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am
index 2f362379..bdc1a884 100755
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am
+++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Makefile.am
@@ -4,8 +4,6 @@ SUBDIRS = meta
install_PYTHON = \
__init__.py \
- flags.py \
- iwlibs.py \
plugin.py \
Wlan.py
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py
index 1c1471ce..baefd435 100755
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py
+++ b/lib/python/Plugins/SystemPlugins/WirelessLan/Wlan.py
@@ -1,7 +1,3 @@
-#from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER
-#from Components.MultiContent import MultiContentEntryText
-#from Components.GUIComponent import GUIComponent
-#from Components.HTMLComponent import HTMLComponent
from Components.config import config, ConfigYesNo, NoSave, ConfigSubsection, ConfigText, ConfigSelection, ConfigPassword
from Components.Console import Console
@@ -10,7 +6,8 @@ from string import maketrans, strip
import sys
import types
from re import compile as re_compile, search as re_search
-from iwlibs import getNICnames, Wireless, Iwfreq
+from pythonwifi.iwlibs import getNICnames, Wireless, Iwfreq, getWNICnames
+from pythonwifi import flags as wififlags
list = []
list.append("WEP")
@@ -65,38 +62,42 @@ class Wlan:
print "self.iface im iwconfigFinished",self.iface
callback = extra_args
data = { 'essid': False, 'frequency': False, 'acesspoint': False, 'bitrate': False, 'encryption': False, 'quality': False, 'signal': False }
- #print "result im iwconfigFinished",result
for line in result.splitlines():
- #print "line",line
line = line.strip()
if "ESSID" in line:
if "off/any" in line:
ssid = _("No Connection")
else:
- tmpssid=(line[line.index('ESSID')+7:len(line)-1])
- if tmpssid == '':
- ssid = _("Hidden networkname")
- elif tmpssid ==' ':
- ssid = _("Hidden networkname")
+ if "Nickname" in line:
+ tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
else:
- ssid = tmpssid
- #print "SSID->",ssid
+ tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
+
if ssid is not None:
data['essid'] = ssid
if 'Frequency' in line:
frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
- #print "Frequency",frequency
if frequency is not None:
data['frequency'] = frequency
if "Access Point" in line:
ap=line[line.index('Access Point')+14:len(line)-1]
- #print "AP",ap
if ap is not None:
data['acesspoint'] = ap
if "Bit Rate" in line:
br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')]
- #print "Bitrate",br
if br is not None:
data['bitrate'] = br
if 'Encryption key' in line:
@@ -104,7 +105,6 @@ class Wlan:
enc = _("Disabled")
else:
enc = line[line.index('Encryption key')+15 :line.index(' Security')]
- #print "Encryption key",enc
if enc is not None:
data['encryption'] = _("Enabled")
if 'Quality' in line:
@@ -112,12 +112,10 @@ class Wlan:
qual = line[line.index('Quality')+8:line.index('/100')]
else:
qual = line[line.index('Quality')+8:line.index('Sig')]
- #print "Quality",qual
if qual is not None:
data['quality'] = qual
if 'Signal level' in line:
- signal = line[line.index('Signal level')+14 :line.index(' dBm')]
- #print "Signal level",signal
+ signal = line[line.index('Signal level')+13 :line.index(' dBm')]
if signal is not None:
data['signal'] = signal
@@ -130,7 +128,6 @@ class Wlan:
callback(True,self.wlaniface)
def getAdapterAttribute(self, attribute):
- print "im getAdapterAttribute"
if self.wlaniface.has_key(self.iface):
print "self.wlaniface.has_key",self.iface
if self.wlaniface[self.iface].has_key(attribute):
@@ -142,13 +139,17 @@ class Wlan:
def getWirelessInterfaces(self):
- iwifaces = None
- try:
- iwifaces = getNICnames()
- except:
- print "[Wlan.py] No Wireless Networkcards could be found"
-
- return iwifaces
+ device = re_compile('[a-z]{2,}[0-9]*:')
+ ifnames = []
+
+ fp = open('/proc/net/wireless', 'r')
+ for line in fp:
+ try:
+ # append matching pattern, without the trailing colon
+ ifnames.append(device.search(line).group()[:-1])
+ except AttributeError:
+ pass
+ return ifnames
def getNetworkList(self):
@@ -156,8 +157,8 @@ class Wlan:
ifobj = Wireless(self.iface) # a Wireless NIC Object
#Association mappings
- stats, quality, discard, missed_beacon = ifobj.getStatistics()
- snr = quality.signallevel - quality.noiselevel
+ #stats, quality, discard, missed_beacon = ifobj.getStatistics()
+ #snr = quality.signallevel - quality.noiselevel
try:
scanresults = ifobj.scan()
@@ -167,55 +168,47 @@ class Wlan:
if scanresults is not None:
aps = {}
+ (num_channels, frequencies) = ifobj.getChannelInfo()
+ index = 1
for result in scanresults:
-
bssid = result.bssid
-
- encryption = map(lambda x: hex(ord(x)), result.encode)
-
- if encryption[-1] == "0x8":
+
+ if result.encode.flags & wififlags.IW_ENCODE_DISABLED > 0:
+ encryption = False
+ elif result.encode.flags & wififlags.IW_ENCODE_NOKEY > 0:
encryption = True
else:
- encryption = False
-
+ encryption = None
+
+ signal = str(result.quality.siglevel-0x100) + " dBm"
+ quality = "%s/%s" % (result.quality.quality,ifobj.getQualityMax().quality)
+
extra = []
for element in result.custom:
element = element.encode()
extra.append( strip(self.asciify(element)) )
-
- if result.quality.sl is 0 and len(extra) > 0:
- begin = extra[0].find('SignalStrength=')+15
-
- done = False
- end = begin+1
-
- while not done:
- if extra[0][begin:end].isdigit():
- end += 1
- else:
- done = True
- end -= 1
-
- signal = extra[0][begin:end]
- #print "[Wlan.py] signal is:" + str(signal)
+ for element in extra:
+ print element
+ if 'SignalStrength' in element:
+ signal = element[element.index('SignalStrength')+15:element.index(',L')]
+ if 'LinkQuality' in element:
+ quality = element[element.index('LinkQuality')+12:len(element)]
- else:
- signal = str(result.quality.sl)
-
aps[bssid] = {
'active' : True,
'bssid': result.bssid,
- 'channel': result.frequency.getChannel(result.frequency.getFrequency()),
+ 'channel': frequencies.index(ifobj._formatFrequency(result.frequency.getFrequency())) + 1,
'encrypted': encryption,
'essid': strip(self.asciify(result.essid)),
'iface': self.iface,
- 'maxrate' : result.rate[-1],
- 'noise' : result.quality.getNoiselevel(),
- 'quality' : str(result.quality.quality),
- 'signal' : signal,
+ 'maxrate' : ifobj._formatBitrate(result.rate[-1][-1]),
+ 'noise' : '',#result.quality.nlevel-0x100,
+ 'quality' : str(quality),
+ 'signal' : str(signal),
'custom' : extra,
}
- print aps[bssid]
+ #print "GOT APS ENTRY:",aps[bssid]
+ index = index + 1
return aps
@@ -226,12 +219,11 @@ class Wlan:
self.channel = str(fq.getChannel(str(ifobj.getFrequency()[0:-3])))
except:
self.channel = 0
- #print ifobj.getStatistics()
status = {
- 'BSSID': str(ifobj.getAPaddr()),
+ 'BSSID': str(ifobj.getAPaddr()), #ifobj.getStatistics()
'ESSID': str(ifobj.getEssid()),
- 'quality': str(ifobj.getStatistics()[1].quality),
- 'signal': str(ifobj.getStatistics()[1].sl),
+ 'quality': "%s/%s" % (ifobj.getStatistics()[1].quality,ifobj.getQualityMax().quality),
+ 'signal': str(ifobj.getStatistics()[1].siglevel-0x100) + " dBm",
'bitrate': str(ifobj.getBitrate()),
'channel': str(self.channel),
#'channel': str(fq.getChannel(str(ifobj.getFrequency()[0:-3]))),
@@ -326,7 +318,6 @@ class wpaSupplicant:
essid = split[1][1:-1]
elif split[0] == 'proto':
- print "split[1]",split[1]
config.plugins.wlan.encryption.enabled.value = True
if split[1] == "WPA" :
mode = 'WPA'
@@ -354,12 +345,9 @@ class wpaSupplicant:
else:
config.plugins.wlan.encryption.wepkeytype.value = 'HEX'
config.plugins.wlan.encryption.psk.value = split[1]
- print "[Wlan.py] Got Encryption: WEP - keytype is: "+config.plugins.wlan.encryption.wepkeytype.value
- print "[Wlan.py] Got Encryption: WEP - key0 is: "+config.plugins.wlan.encryption.psk.value
elif split[0] == 'psk':
config.plugins.wlan.encryption.psk.value = split[1][1:-1]
- print "[Wlan.py] Got PSK: "+split[1][1:-1]
else:
pass
@@ -436,24 +424,30 @@ class Status:
if "off/any" in line:
ssid = _("No Connection")
else:
- tmpssid=(line[line.index('ESSID')+7:len(line)-1])
- if tmpssid == '':
- ssid = _("Hidden networkname")
- elif tmpssid ==' ':
- ssid = _("Hidden networkname")
+ if "Nickname" in line:
+ tmpssid=(line[line.index('ESSID')+7:line.index('" Nickname')])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
else:
- ssid = tmpssid
- #print "SSID->",ssid
+ tmpssid=(line[line.index('ESSID')+7:len(line)-1])
+ if tmpssid == '':
+ ssid = _("Hidden networkname")
+ elif tmpssid ==' ':
+ ssid = _("Hidden networkname")
+ else:
+ ssid = tmpssid
if ssid is not None:
data['essid'] = ssid
if 'Frequency' in line:
frequency = line[line.index('Frequency')+10 :line.index(' GHz')]
- #print "Frequency",frequency
if frequency is not None:
data['frequency'] = frequency
if "Access Point" in line:
ap=line[line.index('Access Point')+14:len(line)]
- #print "AP",ap
if ap is not None:
data['acesspoint'] = ap
if ap == "Not-Associated":
@@ -467,7 +461,6 @@ class Status:
br += " Mb/s"
else:
br = line[line.index('Bit Rate')+9 :line.index(' Mb/s')] + " Mb/s"
- #print "Bitrate",br
if br is not None:
data['bitrate'] = br
if 'Encryption key' in line:
@@ -480,28 +473,30 @@ class Status:
enc = line[line.index('Encryption key')+15 :line.index(' Security')]
if enc is not None:
enc = _("Enabled")
- #print "Encryption key",enc
if enc is not None:
data['encryption'] = enc
if 'Quality' in line:
if "/100" in line:
- qual = line[line.index('Quality')+8:line.index('/100')]
+ #qual = line[line.index('Quality')+8:line.index('/100')]
+ qual = line[line.index('Quality')+8:line.index(' Signal')]
else:
qual = line[line.index('Quality')+8:line.index('Sig')]
- #print "Quality",qual
if qual is not None:
data['quality'] = qual
if 'Signal level' in line:
if "dBm" in line:
- signal = line[line.index('Signal level')+14 :line.index(' dBm')]
+ signal = line[line.index('Signal level')+13 :line.index(' dBm')]
signal += " dBm"
elif "/100" in line:
- signal = line[line.index('Signal level')+13:line.index('/100 Noise')]
- signal += "%"
+ if "Noise" in line:
+ signal = line[line.index('Signal level')+13:line.index(' Noise')]
+ else:
+ signal = line[line.index('Signal level')+13:len(line)]
else:
- signal = line[line.index('Signal level')+13:line.index(' Noise')]
- signal += "%"
- #print "Signal level",signal
+ if "Noise" in line:
+ signal = line[line.index('Signal level')+13:line.index(' Noise')]
+ else:
+ signal = line[line.index('Signal level')+13:len(line)]
if signal is not None:
data['signal'] = signal
@@ -515,12 +510,10 @@ class Status:
callback(True,self.wlaniface)
def getAdapterAttribute(self, iface, attribute):
- print "im getAdapterAttribute"
self.iface = iface
if self.wlaniface.has_key(self.iface):
- print "self.wlaniface.has_key",self.iface
if self.wlaniface[self.iface].has_key(attribute):
return self.wlaniface[self.iface][attribute]
return None
-iStatus = Status() \ No newline at end of file
+iStatus = Status()
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py b/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py
deleted file mode 100755
index 4435f845..00000000
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/flags.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# -*- coding: ISO-8859-1 -*-
-# python-wifi -- a wireless library to access wireless cards via python
-# Copyright (C) 2004, 2005, 2006 Róman Joost
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-modes = ['Auto',
- 'Ad-Hoc',
- 'Managed',
- 'Master',
- 'Repeat',
- 'Second',
- 'Monitor']
-
-IFNAMSIZE = 16
-IW_ESSID_MAX_SIZE = 16
-
-KILO = 10**3
-MEGA = 10**6
-GIGA = 10**9
-
-# ioctl calls for the Linux/i386 kernel
-SIOCIWFIRST = 0x8B00 # FIRST ioctl identifier
-SIOCGIFCONF = 0x8912 # ifconf struct
-SIOCGIWNAME = 0x8B01 # get name == wireless protocol
-SIOCGIWFREQ = 0x8B05 # get channel/frequency
-SIOCSIWMODE = 0x8B06 # set the operation mode
-SIOCGIWMODE = 0x8B07 # get operation mode
-SIOCGIWSENS = 0x8B09 # get sensitivity
-SIOCGIWAP = 0x8B15 # get AP MAC address
-SIOCSIWSCAN = 0x8B18 # set scanning off
-SIOCGIWSCAN = 0x8B19 # get scanning results
-SIOCGIWRATE = 0x8B21 # get default bit rate
-SIOCGIWRTS = 0x8B23 # get rts/cts threshold
-SIOCGIWFRAG = 0x8B25 # get fragmention thrh
-SIOCGIWTXPOW = 0x8B27 # get transmit power (dBm)
-SIOCGIWRETRY = 0x8B29 # get retry limit
-SIOCGIWRANGE = 0x8B0B # range
-SIOCGIWSTATS = 0x8B0F # get wireless statistics
-SIOCSIWESSID = 0x8B1A # set essid
-SIOCGIWESSID = 0x8B1B # get essid
-SIOCGIWPOWER = 0x8B2D # get power managment settings
-SIOCGIWENCODE = 0x8B2B # get encryption information
-SIOCIWLAST = 0x8BFF # LAST ioctl identifier
-
-# Power management flags
-IW_POWER_ON = 0x0000 # No details ...
-IW_POWER_TYPE = 0xF000 # Type of parameter
-IW_POWER_PERIOD = 0x1000 # Value is a period/duration of
-IW_POWER_TIMEOUT = 0x2000 # Value is a timeout
-IW_POWER_MODE = 0x0F00 # Power management mode
-IW_POWER_MIN = 0x0001 # Value is a minimum
-IW_POWER_MAX = 0x0002 # Value is a maximum
-IW_POWER_RELATIVE = 0x0004 # Value is not in seconds/ms/us
-
-# Retry limits
-IW_RETRY_TYPE = 0xF000 # Type of parameter
-
-# encoding stuff
-IW_ENCODE_DISABLED = 0x8000 # encoding is disabled
-IW_ENCODE_NOKEY = 0x0800 # key is write only, not present
-
-# constants responsible for scanning
-IW_SCAN_MAX_DATA = 4096
-
-IW_EV_LCP_LEN = 4
-IW_EV_CHAR_LEN = IW_EV_LCP_LEN + IFNAMSIZE
-IW_EV_UINT_LEN = IW_EV_LCP_LEN + 4
-IW_EV_FREQ_LEN = IW_EV_LCP_LEN + 8
-IW_EV_ADDR_LEN = IW_EV_LCP_LEN + 16
-IW_EV_POINT_LEN = IW_EV_LCP_LEN + 4
-IW_EV_PARAM_LEN = IW_EV_LCP_LEN + 8
-IW_EV_QUAL_LEN = IW_EV_LCP_LEN + 4
-
-EPERM = 1
-E2BIG = 7
-EAGAIN = 11
-
-IWHT_NULL = 0
-IWHT_CHAR = 2
-IWHT_UINT = 4
-IWHT_FREQ = 5
-IWHT_ADDR = 6
-IWHT_POINT = 8
-IWHT_PARAM = 9
-IWHT_QUAL = 10
-
-IWEVFIRST = 0x8C00 # FIRST event identifier
-IWEVQUAL = 0x8C01 # Quality statistics from scan
-IWEVCUSTOM = 0x8C02 # Custom Ascii string from Driver
-IWEVLAST = 0x8C0A # LAST event identifier
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py b/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py
deleted file mode 100755
index c5f9c6d2..00000000
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/iwlibs.py
+++ /dev/null
@@ -1,1114 +0,0 @@
-# -*- coding: ISO-8859-1 -*-
-# python-wifi -- a wireless library to access wireless cards via python
-# Copyright (C) 2004, 2005, 2006 Róman Joost
-#
-# Contributions from:
-# Mike Auty <m.auty@softhome.net> (Iwscanresult, Iwscan)
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public License
-# as published by the Free Software Foundation; either version 2.1 of
-# the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
-# USA
-
-from struct import pack as struct_pack, \
- unpack as struct_unpack, \
- calcsize as struct_calcsize
-
-from array import array
-from math import ceil, log10
-from fcntl import ioctl
-from socket import AF_INET, SOCK_DGRAM, socket
-from time import sleep
-from re import compile
-
-from flags import *
-
-def getNICnames():
- """ extract wireless device names of /proc/net/wireless
-
- returns empty list if no devices are present
-
- >>> getNICnames()
- ['eth1', 'wifi0']
- """
- device = compile('[a-z]+[0-9]+')
- ifnames = []
-
- f = open('/proc/net/wireless', 'r')
- data = f.readlines()
- for line in data:
- try:
- ifnames.append(device.search(line).group())
- except AttributeError:
- pass
- # if we couldn't lookup the devices, try to ask the kernel
- if ifnames == []:
- ifnames = getConfiguredNICnames()
-
- return ifnames
-
-def getConfiguredNICnames():
- """get the *configured* ifnames by a systemcall
-
- >>> getConfiguredNICnames()
- []
- """
- iwstruct = Iwstruct()
- ifnames = []
- buff = array('c', '\0'*1024)
- caddr_t, length = buff.buffer_info()
- s = iwstruct.pack('iP', length, caddr_t)
- try:
- result = iwstruct._fcntl(SIOCGIFCONF, s)
- except IOError, (i, e):
- return i, e
-
- # get the interface names out of the buffer
- for i in range(0, 1024, 32):
- ifname = buff.tostring()[i:i+32]
- ifname = struct_unpack('32s', ifname)[0]
- ifname = ifname.split('\0', 1)[0]
- if ifname:
- # verify if ifnames are really wifi devices
- wifi = Wireless(ifname)
- result = wifi.getAPaddr()
- if result[0] == 0:
- ifnames.append(ifname)
-
- return ifnames
-
-def makedict(**kwargs):
- return kwargs
-
-
-class Wireless(object):
- """Access to wireless interfaces"""
-
- def __init__(self, ifname):
- self.sockfd = socket(AF_INET, SOCK_DGRAM)
- self.ifname = ifname
- self.iwstruct = Iwstruct()
-
- def getAPaddr(self):
- """ returns accesspoint mac address
-
- >>> from iwlibs import Wireless, getNICnames
- >>> ifnames = getNICnames()
- >>> ifnames
- ['eth1', 'wifi0']
- >>> wifi = Wireless(ifnames[0])
- >>> wifi.getAPaddr()
- '00:0D:88:8E:4E:93'
-
- Test with non-wifi card:
- >>> wifi = Wireless('eth0')
- >>> wifi.getAPaddr()
- (95, 'Operation not supported')
-
- Test with non-existant card:
- >>> wifi = Wireless('eth2')
- >>> wifi.getAPaddr()
- (19, 'No such device')
- """
- buff, s = self.iwstruct.pack_wrq(32)
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWAP,
- data=s)
- if i > 0:
- return result
-
- return self.iwstruct.getMAC(result)
-
- def getBitrate(self):
- """returns device currently set bit rate
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getBitrate()
- '11 Mb/s'
- """
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWRATE)
- if i > 0:
- return result
- iwfreq = Iwfreq(result)
- return iwfreq.getBitrate()
-
- def getBitrates(self):
- """returns the number of available bitrates for the device
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> num, rates = wifi.getBitrates()
- >>> num == len(rates)
- True
- """
- range = Iwrange(self.ifname)
- if range.errorflag:
- return (range.errorflag, range.error)
- return (range.num_bitrates, range.bitrates)
-
- def getChannelInfo(self):
- """returns the number of channels and available frequency for
- the device
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> num, rates = wifi.getChannelInfo()
- >>> num == len(rates)
- True
- """
- range = Iwrange(self.ifname)
- if range.errorflag:
- return (range.errorflag, range.error)
- return (range.num_channels, range.frequencies)
-
- def getEssid(self):
- """get essid information
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getEssid()
- 'romanofski'
- """
- essid = ""
- buff, s = self.iwstruct.pack_wrq(32)
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWESSID,
- data=s)
- if i > 0:
- return result
- str = buff.tostring()
- return str.strip('\x00')
-
- def setEssid(self, essid):
- """set essid """
- raise NotImplementedError
- if len(essid) > IW_ESSID_MAX_SIZE:
- return "essid to big"
- buff, s = self.iwstruct.pack_test(essid, 32)
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCSIWESSID,
- data=s)
- if i > 0:
- return result
-
- def getEncryption(self):
- """get encryption information which is probably a string of '*',
- 'open', 'private'
-
- as a normal user, you will get a 'Operation not permitted'
- error:
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getEncryption()
- (1, 'Operation not permitted')
- """
- iwpoint = Iwpoint(self.ifname)
- if iwpoint.errorflag:
- return (iwpoint.errorflag, iwpoint.error)
- return iwpoint.getEncryptionKey()
-
- def getFragmentation(self):
- """returns fragmentation threshold
-
- It depends on what the driver says. If you have fragmentation
- threshold turned on, you'll get an int. If it's turned of
- you'll get a string: 'off'.
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getFragmentation()
- 'off'
- """
- iwparam = Iwparam(self.ifname, SIOCGIWFRAG)
- if iwparam.errorflag:
- return (iwparam.errorflag, iwparam.error)
- return iwparam.getValue()
-
- def getFrequency(self):
- """returns currently set frequency of the card
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getFrequency()
- '2.417GHz'
- """
- i, r = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWFREQ)
- if i > 0:
- return (i, r)
- iwfreq = Iwfreq(r)
- return iwfreq.getFrequency()
-
-
- def getMode(self):
- """returns currently set operation mode
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getMode()
- 'Managed'
- """
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWMODE)
- if i > 0:
- return result
- mode = self.iwstruct.unpack('i', result[:4])[0]
- return modes[mode]
-
- def setMode(self, mode):
- """sets the operation mode """
- try:
- this_modes = [x.lower() for x in modes]
- mode = mode.lower()
- wifimode = this_modes.index(mode)
- except ValueError:
- return "Invalid operation mode!"
-
- s = self.iwstruct.pack('I', wifimode)
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCSIWMODE,
- data=s)
- if i > 0:
- return result
-
- def getWirelessName(self):
- """ returns wireless name
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getWirelessName()
- 'IEEE 802.11-DS'
- """
- i, result = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWNAME)
- if i > 0:
- return result
- return result.split('\0')[0]
-
- def getPowermanagement(self):
- """returns power management settings
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getPowermanagement()
- 'off'
- """
- iwparam = Iwparam(self.ifname, SIOCGIWPOWER)
- if iwparam.errorflag:
- return (iwparam.errorflag, iwparam.error)
- return iwparam.getValue()
-
-
- def getRetrylimit(self):
- """returns limit retry/lifetime
-
- man iwconfig:
- Most cards have MAC retransmissions, and some allow to set
- the behaviour of the retry mechanism.
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getRetrylimit()
- 16
- """
- iwparam = Iwparam(self.ifname, SIOCGIWRETRY)
- if iwparam.errorflag:
- return (iwparam.errorflag, iwparam.error)
- return iwparam.getValue()
-
- def getRTS(self):
- """returns rts threshold
-
- returns int, 'auto', 'fixed', 'off'
-
- man iwconfig:
- RTS/CTS adds a handshake before each packet transmission to
- make sure that the channel is clear. This adds overhead, but
- increases performance in case of hidden nodes or a large
- number of active nodes. This parameter sets the size of the
- smallest packet for which the node sends RTS; a value equal
- to the maximum packet size disable the mechanism.
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getRTS()
- 'off'
- """
- iwparam = Iwparam(self.ifname, SIOCGIWRTS)
- if iwparam.errorflag:
- return (iwparam.errorflag, iwparam.error)
- return iwparam.getValue()
-
- def getSensitivity(self):
- """returns sensitivity information
-
- man iwconfig:
- This is the lowest signal level for which the hardware
- attempt packet reception, signals weaker than this are
- ignored. This is used to avoid receiving background noise,
- so you should set it according to the average noise
- level. Positive values are assumed to be the raw value used
- by the hardware or a percentage, negative values are
- assumed to be dBm.
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getSensitivity()
- 'off'
-
- """
- iwparam = Iwparam(self.ifname, SIOCGIWSENS)
- if iwparam.errorflag:
- return (iwparam.errorflag, iwparam.error)
- return iwparam.getValue()
-
- def getTXPower(self):
- """returns transmit power in dBm
-
- >>> from iwlibs import Wireless
- >>> wifi = Wireless('eth1')
- >>> wifi.getTXPower()
- '17 dBm'
- """
- i, r = self.iwstruct.iw_get_ext(self.ifname,
- SIOCGIWTXPOW)
- if i > 0:
- return (i, r)
- iwfreq = Iwfreq(r)
- return iwfreq.getTransmitPower()
-
- def getStatistics(self):
- """returns statistics information which can also be found in
- /proc/net/wireless
- """
- iwstats = Iwstats(self.ifname)
- if iwstats.errorflag > 0:
- return (iwstats.errorflag, iwstats.error)
- return [iwstats.status, iwstats.qual, iwstats.discard,
- iwstats.missed_beacon]
-
- def scan(self):
- """returns Iwscanresult objects, after a successful scan"""
- iwscan = Iwscan(self.ifname)
- return iwscan.scan()
-
-
-class Iwstruct(object):
- """basic class to handle iwstruct data """
-
- def __init__(self):
- self.idx = 0
- self.sockfd = socket(AF_INET, SOCK_DGRAM)
-
- def parse_data(self, fmt, data):
- """ unpacks raw C data """
- size = struct_calcsize(fmt)
- idx = self.idx
-
- str = data[idx:idx + size]
- self.idx = idx+size
- value = struct_unpack(fmt, str)
-
- # take care of a tuple like (int, )
- if len(value) == 1:
- return value[0]
- else:
- return value
-
- def pack(self, fmt, *args):
- """ calls struct_pack and returns the result """
- return struct_pack(fmt, *args)
-
- def pack_wrq(self, buffsize):
- """ packs wireless request data for sending it to the kernel """
- # Prepare a buffer
- # We need the address of our buffer and the size for it. The
- # ioctl itself looks for the pointer to the address in our
- # memory and the size of it.
- # Dont change the order how the structure is packed!!!
- buff = array('c', '\0'*buffsize)
- caddr_t, length = buff.buffer_info()
- s = struct_pack('Pi', caddr_t, length)
- return buff, s
-
- def pack_test(self, string, buffsize):
- """ packs wireless request data for sending it to the kernel """
- buffsize = buffsize - len(string)
- buff = array('c', string+'\0'*buffsize)
- caddr_t, length = buff.buffer_info()
- s = struct_pack('Pii', caddr_t, length, 1)
- return buff, s
-
- def unpack(self, fmt, packed_data):
- """ unpacks data with given format """
- return struct_unpack(fmt, packed_data)
-
- def _fcntl(self, request, args):
- return ioctl(self.sockfd.fileno(), request, args)
-
- def iw_get_ext(self, ifname, request, data=None):
- """ read information from ifname """
- # put some additional data behind the interface name
- if data is not None:
- buff = IFNAMSIZE-len(ifname)
- ifreq = ifname + '\0'*buff
- ifreq = ifreq + data
- else:
- ifreq = (ifname + '\0'*32)
-
- try:
- result = self._fcntl(request, ifreq)
- except IOError, (i, e):
- return i, e
-
- return (0, result[16:])
-
- def getMAC(self, packed_data):
- """ extracts mac addr from packed data and returns it as str """
- mac_addr = struct_unpack('xxBBBBBB', packed_data[:8])
- return "%02X:%02X:%02X:%02X:%02X:%02X" % mac_addr
-
-class Iwparam(object):
- """class to hold iwparam data """
-
- def __init__(self, ifname, ioctl):
- # (i) value, (b) fixed, (b) disabled, (b) flags
- self.fmt = "ibbH"
- self.value = 0
- self.fixed = 0
- self.disabled = 0
- self.flags = 0
- self.errorflag = 0
- self.error = ""
- self.ioctl = ioctl
- self.ifname = ifname
- self.update()
-
- def getValue(self):
- """returns the value if not disabled """
-
- if self.disabled:
- return 'off'
- if self.flags & IW_RETRY_TYPE == 0:
- return self.getRLAttributes()
- else:
- return self.getPMAttributes()
-
- def getRLAttributes(self):
- """returns a string with attributes determined by self.flags
- """
- return self.value
-
- def getPMAttributes(self):
- """returns a string with attributes determined by self.flags
- and IW_POWER*
- """
- result = ""
-
- # Modifiers
- if self.flags & IW_POWER_MIN == 0:
- result = " min"
- if self.flags & IW_POWER_MAX == 0:
- result = " max"
-
- # Type
- if self.flags & IW_POWER_TIMEOUT == 0:
- result = " period:"
- else:
- result = " timeout:"
- # Value with or without units
- # IW_POWER_RELATIVE - value is *not* in s/ms/us
- if self.flags & IW_POWER_RELATIVE:
- result += "%f" %(float(self.value)/MEGA)
- else:
- if self.value >= MEGA:
- result += "%fs" %(float(self.value)/MEGA)
- elif self.value >= KILO:
- result += "%fms" %(float(self.value)/KILO)
- else:
- result += "%dus" % self.value
-
- return result
-
- def update(self):
- iwstruct = Iwstruct()
- i, r = iwstruct.iw_get_ext(self.ifname,
- self.ioctl)
- if i > 0:
- self.errorflag = i
- self.error = r
- self._parse(r)
-
- def _parse(self, data):
- """ unpacks iwparam data """
- iwstruct = Iwstruct()
- self.value, self.fixed, self.disabled, self.flags =\
- iwstruct.parse_data(self.fmt, data)
-
-class Iwfreq(object):
- """ class to hold iwfreq data
- delegates to Iwstruct class
- """
-
- def __init__(self, data=None):
- self.fmt = "ihbb"
- if data is not None:
- self.frequency = self.parse(data)
- else:
- self.frequency = 0
- self.iwstruct = Iwstruct()
-
- def __getattr__(self, attr):
- return getattr(self.iwstruct, attr)
-
- def parse(self, data):
- """ unpacks iwparam"""
-
- size = struct_calcsize(self.fmt)
- m, e, i, pad = struct_unpack(self.fmt, data[:size])
- # XXX well, its not *the* frequency - we need a better name
- if e == 0:
- return m
- else:
- return float(m)*10**e
-
- def getFrequency(self):
- """returns Frequency (str)
-
- data - binary data returned by systemcall (iw_get_ext())
- """
- freq = self.frequency
-
- if freq >= GIGA:
- return "%0.3fGHz" %(freq/GIGA)
-
- if freq >= MEGA:
- return "%0.3fMHZ" %(freq/MEGA)
-
- if freq >= KILO:
- return "%0.3fKHz" %(freq/KILO)
-
- def getBitrate(self):
- """ returns Bitrate in Mbit
-
- data - binary data returned by systemcall (iw_get_ext())
- """
- bitrate = self.frequency
-
- if bitrate >= GIGA:
- return "%i Gb/s" %(bitrate/GIGA)
-
- if bitrate >= MEGA:
- return "%i Mb/s" %(bitrate/MEGA)
-
- if bitrate >= KILO:
- return "%i Kb/s" %(bitrate/KILO)
-
- def getTransmitPower(self):
- """ returns transmit power in dbm """
- # XXX something flaky is going on with m and e
- # eg. m = 50 and e should than be 0, because the number is stored in
- # m and don't needs to be recalculated
- return "%i dBm" %self.mw2dbm(self.frequency/10)
-
- def getChannel(self, freq):
- """returns channel information given by frequency
-
- returns None if frequency can't be converted
- freq = frequency to convert (int)
- iwrange = Iwrange object
- """
-
- try:
- freq = float(freq)
- except:
- return None
-
- lut = {}
- #13 Channels beginning at 2.412GHz and inreasing by 0,005 GHz steps
- for i in range(0,12):
- cur = float( 2.412 + ( i * 0.005 ) )
- lut[str(cur)] = i+1
- # Channel 14 need special actions ;)
- lut['2.484'] = 14
-
-
- if str(freq) in lut.keys():
- return lut[str(freq)]
-
- return None
-
-
- def mw2dbm(self, mwatt):
- """ converts mw to dbm(float) """
- return ceil(10.0 * log10(mwatt))
-
- def _setFrequency(self, list):
- """sets self.frequency by given list
-
- currently only used by Iwrange
- """
- assert len(list) == 4
- m, e, i, pad = list
- if e == 0:
- self.frequency = m
- else:
- self.frequency = m #float(m)*10**e
-
-class Iwstats(object):
- """ class to hold iwstat data """
-
- def __init__(self, ifname):
- # (2B) status, 4B iw_quality, 6i iw_discarded
- self.fmt = "2B4B6i"
- self.status = 0
- self.qual = Iwquality()
- self.discard = {}
- self.missed_beacon = 0
- self.ifname = ifname
- self.errorflag = 0
- self.error = ""
- self.update()
-
- def update(self):
- iwstruct = Iwstruct()
- buff, s = iwstruct.pack_wrq(32)
- i, result = iwstruct.iw_get_ext(self.ifname,
- SIOCGIWSTATS,
- data=s)
- if i > 0:
- self.error = result
- self.errorflag = i
- self._parse(buff.tostring())
-
- def _parse(self, data):
- """ unpacks iwstruct data """
- struct = Iwstruct()
- iwqual = Iwquality()
- iwstats_data = struct.parse_data(self.fmt, data)
-
- self.status = iwstats_data[0:2]
- self.qual.quality, self.qual.sl, self.qual.nl,\
- self.qual.flags = iwstats_data[2:6]
- nwid, code, frag, retries, flags = iwstats_data[6:11]
- self.missed_beacon = iwstats_data[11:12][0]
- self.discard = makedict(nwid=nwid, code=code,
- fragment=frag, retries=retries, misc=flags)
-
-class Iwquality(object):
- """ class to hold iwquality data """
-
- def __init__(self):
- self.quality = 0
- self.sl = 0
- self.nl = 0
- self.updated = 0
- self.fmt = "4B"
-
- def parse(self, data):
- """ unpacks iwquality data """
- struct = Iwstruct()
- qual, sl, nl, flags = struct.parse_data(self.fmt, data)
-
- # compute signal and noise level
- self.signal_level = sl
- self.noise_level = nl
-
- # asign the other values
- self.quality = qual
- self.updated = flags
-
- def setValues(self, list):
- """ assigns values given by a list to our attributes """
- attributes = ["quality", "signallevel", "noise_level",
- "updated"]
- assert len(list) == 4
-
- for i in range(len(list)):
- setattr(self, attributes[i], list[i])
-
- def getSignallevel(self):
- """ returns signal level """
- return self.sl-0x100
-
- def setSignallevel(self, sl):
- """ sets signal level """
- self.sl = sl
- signallevel = property(getSignallevel, setSignallevel)
-
- def getNoiselevel(self):
- """ returns noise level """
- return self.nl - 0x100
-
- def setNoiselevel(self):
- raise NotImplementedError
- self.nl = nl
- noiselevel = property(getNoiselevel, setNoiselevel)
-
-class Iwpoint(object):
- """ class to hold iwpoint data """
-
- def __init__(self, ifname):
- self.key = [0,0,0,0]
- self.fields = 0
- self.flags = 0
- # (4B) pointer to data, H length, H flags
- self.fmt = "4BHH"
- self.errorflag = 0
- self.error = ""
- self.ifname = ifname
- self.update()
-
- def __getattr__(self, attr):
- return getattr(self.iwstruct, attr)
-
- def update(self):
- iwstruct = Iwstruct()
- buff, s = iwstruct.pack_wrq(32)
- i, result = iwstruct.iw_get_ext(self.ifname,
- SIOCGIWENCODE,
- data=s)
- if i > 0:
- self.errorflag = i
- self.error = result
- self._parse(result)
-
- def getEncryptionKey(self):
- """ returns encryption key as '**' or 'off' as str """
- if self.flags & IW_ENCODE_DISABLED != 0:
- return 'off'
- elif self.flags & IW_ENCODE_NOKEY != 0:
- # a key is set, so print it
- return '**' * self.fields
-
- def _parse(self, data):
- """ unpacks iwpoint data
- """
- iwstruct = Iwstruct()
- ptr, ptr, ptr, ptr, self.fields, self.flags =\
- iwstruct.parse_data(self.fmt, data)
- self.key = [ptr, ptr, ptr, ptr]
-
-class Iwrange(object):
- """holds iwrange struct """
- IW_MAX_FREQUENCIES = 32
-
- def __init__(self, ifname):
- self.fmt = "iiihb6ii4B4Bi32i2i2i2i2i3h8h2b2bhi8i2b3h2i2ihB17x"\
- + self.IW_MAX_FREQUENCIES*"ihbb"
-
- self.ifname = ifname
- self.errorflag = 0
- self.error = ""
-
- # informative stuff
- self.throughput = 0
-
- # nwid (or domain id)
- self.min_nwid = self.max_nwid = 0
-
- # frequency for backward compatibility
- self.old_num_channels = self.old_num_frequency = self.old_freq = 0
-
- # signal level threshold
- self.sensitivity = 0
-
- # link quality
- self.max_qual = Iwquality()
- self.avg_qual = Iwquality()
-
- # rates
- self.num_bitrates = 0
- self.bitrates = []
-
- # rts threshold
- self.min_rts = self.max_rts = 0
-
- # fragmention threshold
- self.min_frag = self.max_frag = 0
-
- # power managment
- self.min_pmp = self.max_pmp = 0
- self.min_pmt = self.max_pmt = 0
- self.pmp_flags = self.pmt_flags = self.pm_capa = 0
-
- # encoder stuff
- self.encoding_size = 0
- self.num_encoding_sizes = self.max_encoding_tokens = 0
- self.encoding_login_index = 0
-
- # transmit power
- self.txpower_capa = self.num_txpower = self.txpower = 0
-
- # wireless extension version info
- self.we_vers_compiled = self.we_vers_src = 0
-
- # retry limits and lifetime
- self.retry_capa = self.retry_flags = self.r_time_flags = 0
- self.min_retry = self.max_retry = 0
- self.min_r_time = self.max_r_time = 0
-
- # frequency
- self.num_channels = self.num_frequency = 0
- self.frequencies = []
- self.update()
-
- def update(self):
- """updates Iwrange object by a system call to the kernel
- and updates internal attributes
- """
- iwstruct = Iwstruct()
- buff, s = iwstruct.pack_wrq(640)
- i, result = iwstruct.iw_get_ext(self.ifname,
- SIOCGIWRANGE,
- data=s)
- if i > 0:
- self.errorflag = i
- self.error = result
- data = buff.tostring()
- self._parse(data)
-
- def _parse(self, data):
- struct = Iwstruct()
- result = struct.parse_data(self.fmt, data)
-
- # XXX there is maybe a much more elegant way to do this
- self.throughput, self.min_nwid, self.max_nwid = result[0:3]
- self.old_num_channels, self.old_num_frequency = result[3:5]
- self.old_freq = result[5:11]
- self.sensitivity = result[11]
- self.max_qual.setValues(result[12:16])
- self.avg_qual.setValues(result[16:20])
- self.num_bitrates = result[20] # <- XXX
- raw_bitrates = result[21:53]
- for rate in raw_bitrates:
- iwfreq = Iwfreq()
- iwfreq.frequency = rate
- br = iwfreq.getBitrate()
- if br is not None:
- self.bitrates.append(br)
-
- self.min_rts, self.max_rts = result[53:55]
- self.min_frag, self.max_frag = result[55:57]
- self.min_pmp, self.max_pmp = result[57:59]
- self.min_pmt, self.max_pmt = result[59:61]
- self.pmp_flags, self.pmt_flags, self.pm_capa = result[61:64]
- self.encoding_size = result[64:72]
- self.num_encoding_sizes, self.max_encoding_tokens = result[72:74]
- self.encoding_login_index = result[74:76]
- self.txpower_capa, self.num_txpower = result[76:78]
- self.txpower = result[78:86]
- self.we_vers_compiled, self.we_vers_src = result[86:88]
- self.retry_capa, self.retry_flags, self.r_time_flags = result[88:91]
- self.min_retry, self.max_retry = result[91:93]
- self.min_r_time, self.max_r_time = result[93:95]
- self.num_channels = result[95]
- self.num_frequency = result[96]
- freq = result[97:]
-
- i = self.num_frequency
- for x in range(0, len(freq), 4):
- iwfreq = Iwfreq()
- iwfreq._setFrequency(freq[x:x+4])
- fq = iwfreq.getFrequency()
- if fq is not None:
- self.frequencies.append(fq)
- i -= 1
- if i <= 0:
- break
-
-class Iwscan(object):
- """class to handle AP scanning"""
-
- def __init__(self, ifname):
- self.ifname = ifname
- self.range = Iwrange(ifname)
- self.errorflag = 0
- self.error = ""
- self.stream = None
- self.aplist = None
-
- def scan(self, fullscan=True):
- """Completes a scan for available access points,
- and returns them in Iwscanresult format
-
- fullscan: If False, data is read from a cache of the last scan
- If True, a scan is conducted, and then the data is read
- """
- # By default everything is fine, do not wait
- result = 1
- if fullscan:
- self.setScan()
- if self.errorflag > EPERM:
- raise RuntimeError, 'setScan failure ' + str(self.errorflag) + " " + str(self.error)
- return None
- elif self.errorflag < EPERM:
- # Permission was NOT denied, therefore we must WAIT to get results
- result = 250
-
- while (result > 0):
- sleep(result/1000)
- result = self.getScan()
-
- if result < 0 or self.errorflag != 0:
- raise RuntimeError, 'getScan failure ' + str(self.errorflag) + " " + str(self.error)
-
- return self.aplist
-
-
- def setScan(self):
- """Triggers the scan, if we have permission
- """
- iwstruct = Iwstruct()
- s = iwstruct.pack('Pii', 0, 0, 0)
- i, result = iwstruct.iw_get_ext(self.ifname,
- SIOCSIWSCAN,s)
- if i > 0:
- self.errorflag = i
- self.error = result
- return result
-
- def getScan(self):
- """Retreives results, stored from the most recent scan
- Returns 0 if successful, a delay if the data isn't ready yet
- or -1 if something really nasty happened
- """
- iwstruct = Iwstruct()
- i = E2BIG
- bufflen = IW_SCAN_MAX_DATA
-
- # Keep resizing the buffer until it's large enough to hold the scan
- while (i == E2BIG):
- buff, s = iwstruct.pack_wrq(bufflen)
- i, result = iwstruct.iw_get_ext(self.ifname,
- SIOCGIWSCAN,
- data=s)
- if i == E2BIG:
- pbuff, newlen = iwstruct.unpack('Pi', s)
- if bufflen < newlen:
- bufflen = newlen
- else:
- bufflen = bufflen * 2
-
- if i == EAGAIN:
- return 100
- if i > 0:
- self.errorflag = i
- self.error = result
- return -1
-
- pbuff, reslen = iwstruct.unpack('Pi', s)
- if reslen > 0:
- # Initialize the stream, and turn it into an enumerator
- self.aplist = self._parse(buff.tostring())
- return 0
-
- def _parse(self, data):
- """Parse the event stream, and return a list of Iwscanresult objects
- """
- iwstruct = Iwstruct()
- scanresult = None
- aplist = []
-
- # Run through the stream, until broken
- while 1:
- # If we're the stream doesn't have enough space left for a header, break
- if len(data) < IW_EV_LCP_LEN:
- break;
-
- # Unpack the header
- length, cmd = iwstruct.unpack('HH', data[:4])
- # If the header says the following data is shorter than the header, then break
- if length < IW_EV_LCP_LEN:
- break;
-
- # Put the events into their respective result data
- if cmd == SIOCGIWAP:
- if scanresult is not None:
- aplist.append(scanresult)
- scanresult = Iwscanresult(data[IW_EV_LCP_LEN:length], self.range)
- elif scanresult is None:
- raise RuntimeError, 'Attempting to add an event without AP data'
- else:
- scanresult.addEvent(cmd, data[IW_EV_LCP_LEN:length])
-
- # We're finished with the preveious event
- data = data[length:]
-
- # Don't forgset the final result
- if scanresult.bssid != "00:00:00:00:00:00":
- aplist.append(scanresult)
- else:
- raise RuntimeError, 'Attempting to add an AP without a bssid'
- return aplist
-
-class Iwscanresult(object):
- """An object to contain all the events associated with a single scanned AP
- """
-
- def __init__(self, data, range):
- """Initialize the scan result with the access point data"""
- self.iwstruct = Iwstruct()
- self.range = range
- self.bssid = "%02X:%02X:%02X:%02X:%02X:%02X" % struct_unpack('BBBBBB', data[2:8])
- self.essid = None
- self.mode = None
- self.rate = []
- self.quality = Iwquality()
- self.frequency = None
- self.encode = None
- self.custom = []
- self.protocol = None
-
- def addEvent(self, cmd, data):
- """Attempts to add the data from an event to a scanresult
- Only certain data is accept, in which case the result is True
- If the event data is invalid, None is returned
- If the data is valid but unused, False is returned
- """
- if cmd <= SIOCIWLAST:
- if cmd < SIOCIWFIRST:
- return None
- elif cmd >= IWEVFIRST:
- if cmd > IWEVLAST:
- return None
- else:
- return None
-
- if cmd == SIOCGIWESSID:
- self.essid = data[4:]
- elif cmd == SIOCGIWMODE:
- self.mode = modes[self.iwstruct.unpack('i', data[:4])[0]]
- elif cmd == SIOCGIWRATE:
- # TODO, deal with multiple rates, or at least the highest rate
- freqsize = struct_calcsize("ihbb")
- while len(data) >= freqsize:
- iwfreq = Iwfreq(data)
- self.rate.append(iwfreq.getBitrate())
- data = data[freqsize:]
- elif cmd == IWEVQUAL:
- self.quality.parse(data)
- elif cmd == SIOCGIWFREQ:
- self.frequency = Iwfreq(data)
- elif cmd == SIOCGIWENCODE:
- self.encode = data
- elif cmd == IWEVCUSTOM:
- self.custom.append(data[1:])
- elif cmd == SIOCGIWNAME:
- self.protocol = data[:len(data)-2]
- else:
- #print "Cmd:", cmd
- return False
- return True \ No newline at end of file
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml
index 1f882b32..eca6c0f9 100755
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml
+++ b/lib/python/Plugins/SystemPlugins/WirelessLan/meta/plugin_wirelesslan.xml
@@ -3,22 +3,14 @@
<tag type="Network" />
<tag type="System" />
</prerequisites>
- <info language="en">
+ <info>
<author>Dream Multimedia</author>
<name>WirelessLan</name>
<packagename>enigma2-plugin-systemplugins-wirelesslan</packagename>
<shortdescription>Configure your WLAN network interface</shortdescription>
- <description>The WirelessLan extensions helps you configuring your WLAN network interface.</description>
+ <description>The WirelessLan plugin helps you configuring your WLAN network interface.</description>
<screenshot src="http://www.dreamboxupdate.com/preview/plugin_wirelesslan_en.jpg" />
</info>
- <info language="de">
- <author>Dream Multimedia</author>
- <name>WirelessLan</name>
- <packagename>enigma2-plugin-systemplugins-wirelesslan</packagename>
- <shortdescription>Konfigurieren Sie Ihr WLAN Netzwerk.</shortdescription>
- <description>Die WirelessLan Erweiterung hilft Ihnen beim konfigurieren Ihres WLAN Netzwerkes..</description>
- <screenshot src="http://www.dreamboxupdate.com/preview/plugin_wirelesslan_de.jpg" />
- </info>
<files type="package"> <!-- without version, without .ipk -->
<file type="package" name="enigma2-plugin-systemplugins-wirelesslan" />
diff --git a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
index a687714d..a13c7975 100755
--- a/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
+++ b/lib/python/Plugins/SystemPlugins/WirelessLan/plugin.py
@@ -1,4 +1,4 @@
-from enigma import eTimer
+from enigma import eTimer, eTPM, eEnv
from Screens.Screen import Screen
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Pixmap import Pixmap,MultiPixmap
@@ -14,9 +14,11 @@ from Plugins.Plugin import PluginDescriptor
from os import system, path as os_path, listdir
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
from Tools.LoadPixmap import LoadPixmap
+from Tools.HardwareInfo import HardwareInfo
from Wlan import Wlan, wpaSupplicant, iStatus
+import sha
-plugin_path = "/usr/lib/enigma2/python/Plugins/SystemPlugins/WirelessLan"
+plugin_path = eEnv.resolve("${libdir}/enigma2/python/Plugins/SystemPlugins/WirelessLan")
list = []
list.append("WEP")
@@ -122,7 +124,7 @@ class WlanStatus(Screen):
if status is not None:
self["BSSID"].setText(status[self.iface]["acesspoint"])
self["ESSID"].setText(status[self.iface]["essid"])
- self["quality"].setText(status[self.iface]["quality"]+"%")
+ self["quality"].setText(status[self.iface]["quality"])
self["signal"].setText(status[self.iface]["signal"])
self["bitrate"].setText(status[self.iface]["bitrate"])
self["enc"].setText(status[self.iface]["encryption"])
@@ -373,6 +375,45 @@ class WlanScan(Screen):
return self.WlanList
+def bin2long(s):
+ return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+ res = ""
+ for byte in range(128):
+ res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+ return res
+
+def rsa_pub1024(src, mod):
+ return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+
+def decrypt_block(src, mod):
+ if len(src) != 128 and len(src) != 202:
+ return None
+ dest = rsa_pub1024(src[:128], mod)
+ hash = sha.new(dest[1:107])
+ if len(src) == 202:
+ hash.update(src[131:192])
+ result = hash.digest()
+ if result == dest[107:127]:
+ return dest
+ return None
+
+def validate_cert(cert, key):
+ buf = decrypt_block(cert[8:], key)
+ if buf is None:
+ return None
+ return buf[36:107] + cert[139:196]
+
+def read_random():
+ try:
+ fd = open("/dev/urandom", "r")
+ buf = fd.read(8)
+ fd.close()
+ return buf
+ except:
+ return None
+
def WlanStatusScreenMain(session, iface):
session.open(WlanStatus, iface)
@@ -387,8 +428,32 @@ def callFunction(iface):
def configStrings(iface):
- driver = iNetwork.detectWlanModule()
- print "Found WLAN-Driver:",driver
+ hardware_info = HardwareInfo()
+ if hardware_info.device_name != "dm7025":
+ rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+ etpm = eTPM()
+ l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+ if l2cert is None:
+ return
+ l2key = validate_cert(l2cert, rootkey)
+ if l2key is None:
+ return
+ l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+ if l3cert is None:
+ print "better run the genuine dreambox plugin"
+ return
+ l3key = validate_cert(l3cert, l2key)
+ if l3key is None:
+ return
+ rnd = read_random()
+ if rnd is None:
+ return
+ val = etpm.challenge(rnd)
+ result = decrypt_block(val, l3key)
+ if hardware_info.device_name == "dm7025" or result[80:88] == rnd:
+ driver = iNetwork.detectWlanModule(iface)
+ else:
+ driver = 'dreambox'
if driver in ('ralink', 'zydas'):
return " pre-up /usr/sbin/wpa_supplicant -i"+iface+" -c/etc/wpa_supplicant.conf -B -D"+driver+"\n post-down wpa_cli terminate"
else:
@@ -399,4 +464,3 @@ def configStrings(iface):
def Plugins(**kwargs):
return PluginDescriptor(name=_("Wireless LAN"), description=_("Connect to a Wireless Network"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": callFunction, "configStrings": configStrings, "WlanPluginEntry": lambda x: "Wireless Network Configuartion..."})
- \ No newline at end of file
diff --git a/lib/python/Plugins/newplugin.py b/lib/python/Plugins/newplugin.py
index c1c6f948..32c7269d 100644..100755
--- a/lib/python/Plugins/newplugin.py
+++ b/lib/python/Plugins/newplugin.py
@@ -137,7 +137,7 @@ def Plugins(**kwargs):
file.close()
makefile = open(pluginpath + "/Makefile.am", "w")
-makefile.write("""installdir = $(LIBDIR)/enigma2/python/Plugins/%s/%s
+makefile.write("""installdir = $(pkglibdir)/python/Plugins/%s/%s
install_PYTHON = \\
__init__.py \\