def createscreen(self): AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' self["LabelBSSID"].setText(_('Accesspoint:')) self["LabelESSID"].setText(_('SSID:')) self["LabelQuality"].setText(_('Link Quality:')) self["LabelSignal"].setText(_('Signal Strength:')) self["LabelBitrate"].setText(_('Bitrate:')) self["LabelEnc"].setText(_('Encryption:')) hostname = file('/proc/sys/kernel/hostname').read() AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(AboutText)
def getFeedSatus(self): status = '1' trafficLight = 'unknown' if about.getIfConfig('eth0').has_key('addr') or about.getIfConfig('eth1').has_key('addr') or about.getIfConfig('wlan0').has_key('addr') or about.getIfConfig('ra0').has_key('addr'): try: print '[OnlineVersionCheck] Checking feeds state' req = urllib2.Request('http://openvix.co.uk/TrafficLightState.php') d = urllib2.urlopen(req) trafficLight = d.read() except urllib2.HTTPError as err: print '[OnlineVersionCheck] ERROR:', err trafficLight = err.code except urllib2.URLError as err: print '[OnlineVersionCheck] ERROR:', err.reason[0] trafficLight = err.reason[0] except urllib2 as err: print '[OnlineVersionCheck] ERROR:', err trafficLight = err except: print '[OnlineVersionCheck] ERROR:', sys.exc_info()[0] trafficLight = -2 if not self.IsInt(trafficLight) and getImageType() != 'release': trafficLight = 'unknown' elif trafficLight == 'stable': status = '0' config.softwareupdate.updateisunstable.setValue(status) print '[OnlineVersionCheck] PASSED:', trafficLight return trafficLight else: print '[OnlineVersionCheck] ERROR: -2' return -2
def getFeedSatus(self): status = '1' trafficLight = 'unknown' if about.getIfConfig('eth0').has_key('addr') or about.getIfConfig( 'eth1').has_key('addr') or about.getIfConfig('wlan0').has_key( 'addr') or about.getIfConfig('ra0').has_key('addr'): try: print '[OnlineVersionCheck] Checking feeds state' req = urllib2.Request( 'http://openvix.co.uk/TrafficLightState.php') d = urllib2.urlopen(req) trafficLight = d.read() except urllib2.HTTPError as err: print '[OnlineVersionCheck] ERROR:', err trafficLight = err.code except urllib2.URLError as err: print '[OnlineVersionCheck] ERROR:', err.reason[0] trafficLight = err.reason[0] except urllib2 as err: print '[OnlineVersionCheck] ERROR:', err trafficLight = err except: print '[OnlineVersionCheck] ERROR:', sys.exc_info()[0] trafficLight = -2 if not self.IsInt(trafficLight) and getImageType() != 'release': trafficLight = 'unknown' elif trafficLight == 'stable': status = '0' config.softwareupdate.updateisunstable.setValue(status) print '[OnlineVersionCheck] PASSED:', trafficLight return trafficLight else: print '[OnlineVersionCheck] ERROR: -2' return -2
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' self["LabelBSSID"].setText(_('Accesspoint:')) self["LabelESSID"].setText(_('SSID:')) self["LabelQuality"].setText(_('Link Quality:')) self["LabelSignal"].setText(_('Signal Strength:')) self["LabelBitrate"].setText(_('Bitrate:')) self["LabelEnc"].setText(_('Encryption:')) rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" hostname = file('/proc/sys/kernel/hostname').read() AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(AboutText)
def listecminfo(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if 'addr' in eth0: self.AboutText += _("IP:") + eth0['addr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if 'addr' in eth1: self.AboutText += _("IP:") + eth1['addr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if 'addr' in ra0: self.AboutText += _("IP:") + ra0['addr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if 'addr' in wlan0: self.AboutText += _("IP:") + wlan0['addr'] + "\n" self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if 'addr' in wlan1: self.AboutText += _("IP:") + wlan1['addr'] + "\n" self.iface = 'wlan1' self.Console.ePopen("ethtool " + self.iface + " | grep Link ", self.Stage1Complete)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if 'addr' in eth0: self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if 'netmask' in eth0: self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if 'hwaddr' in eth0: self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if 'addr' in eth1: self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if 'netmask' in eth1: self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if 'hwaddr' in eth1: self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if 'addr' in ra0: self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if 'netmask' in ra0: self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if 'hwaddr' in ra0: self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if 'addr' in wlan0: self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if 'netmask' in wlan0: self.AboutText += _( "Netmask:") + "\t" + wlan0['netmask'] + "\n" if 'hwaddr' in wlan0: self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if 'addr' in wlan1: self.AboutText += _("IP:") + "\t" + wlan1['addr'] + "\n" if 'netmask' in wlan1: self.AboutText += _( "Netmask:") + "\t" + wlan1['netmask'] + "\n" if 'hwaddr' in wlan1: self.AboutText += _("MAC:") + "\t" + wlan1['hwaddr'] + "\n" self.iface = 'wlan1' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" hostname = open('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan3 = about.getIfConfig('wlan3') if wlan3.has_key('addr'): self.AboutText += _("IP:") + "\t" + wlan3['addr'] + "\n" if wlan3.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan3['netmask'] + "\n" if wlan3.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan3['hwaddr'] + "\n" self.iface = 'wlan3' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" self.console = Console() self.console.ePopen('ethtool %s' % self.iface, self.SpeedFinished)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan3 = about.getIfConfig('wlan3') if wlan3.has_key('addr'): self.AboutText += _("IP:") + "\t" + wlan3['addr'] + "\n" if wlan3.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + wlan3['netmask'] + "\n" if wlan3.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan3['hwaddr'] + "\n" self.iface = 'wlan3' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" self.console = Console() self.console.ePopen('ethtool %s' % self.iface, self.SpeedFinished)
def getFeedSatus(self): trafficLight = 'unknown' if about.getIfConfig('eth0').has_key('addr') or about.getIfConfig('eth1').has_key('addr') or about.getIfConfig('wlan0').has_key('addr') or about.getIfConfig('ra0').has_key('addr'): try: req = urllib2.Request('http://openvix.co.uk/TrafficLightState.php') d = urllib2.urlopen(req) trafficLight = d.read() except urllib2.HTTPError, err: print 'ERROR:',err trafficLight = err.code except urllib2.URLError, err: print 'ERROR:',err.reason[0] trafficLight = err.reason[0]
def adapterAvailable(self): # Box has an adapter configured and active for adapter in ('eth0', 'eth1', 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'ra0'): if about.getIfConfig(adapter).has_key('addr'): print "[OnlineUpdateCheck][adapterAvailable] PASSED" return True print "[OnlineUpdateCheck][adapterAvailable] FAILED" return False
def checkWlanStateCB(self,data,status): if data is not None: if data is True: if status is not None: wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): text11 = _("Your IP:") + "\t" + wlan0['addr'] + "\n\n" if wlan0.has_key('netmask'): text11 += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): text11 += _("Broadcast:") + "\t" + wlan0['brdaddr'] + "\n" if wlan0.has_key('hwaddr'): text11 += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n\n" text1 = _("Your %s %s is now ready to be used.\n\nYour internet connection is working now.\n\n") % (getMachineBrand(), getMachineName()) text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["accesspoint"]) + "\n" text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\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:') + "\t" + str(status[self.selectedInterface]["encryption"]) + "\n" text8 = _("Please press OK to continue.") try: infotext = text1 + text11 + text2 + text3 + text4 + text5 + text6 + text7 + "\n" + text8 except: infotext = text1 + text2 + text3 + text4 + text5 + text6 + text7 + "\n" + text8 self.currStep = self.getStepWithID("checkWlanstatusend") self.Text = infotext if str(status[self.selectedInterface]["accesspoint"]) == "Not-Associated": self.InterfaceState = False self.afterAsyncCode()
def checkWlanStateCB(self,data,status): if data is not None: if data is True: if status is not None: wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): text11 = _("Your IP:") + "\t" + wlan0['addr'] + "\n\n" if wlan0.has_key('netmask'): text11 += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): text11 += _("Gateway:") + "\t" + wlan0['brdaddr'] + "\n" if wlan0.has_key('hwaddr'): text11 += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n\n" text1 = _("Your %s %s is now ready to be used.\n\nYour internet connection is working now.\n\n") % (getMachineBrand(), getMachineName()) text2 = _('Accesspoint:') + "\t" + str(status[self.selectedInterface]["accesspoint"]) + "\n" text3 = _('SSID:') + "\t" + str(status[self.selectedInterface]["essid"]) + "\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"]) + " Mbps\n" text7 = _('Encryption:') + "\t" + str(status[self.selectedInterface]["encryption"]) + "\n" text8 = _("Please press OK to continue.") try: infotext = text1 + text11 + text2 + text3 + text4 + text6 + text7 + "\n" + text8 except: infotext = text1 + text2 + text3 + text4 + text6 + text7 + "\n" + text8 self.currStep = self.getStepWithID("checkWlanstatusend") self.Text = infotext if str(status[self.selectedInterface]["accesspoint"]) == "Not-Associated": self.InterfaceState = False self.afterAsyncCode()
def JobTask(self): # Network state symbol netSymbol = "/proc/stb/lcd/symbol_network" if fileExists(netSymbol): linkUp = 0 if config.lcd.mode.value == '1': for ifName in iNetwork.getInstalledAdapters(): ifState = about.getIfConfig(ifName) if ('flags' in ifState and ifState['flags'].get('up') and ifState['flags'].get('running')): linkUp = 1 break open(netSymbol, "w").write(str(linkUp)) # USB devices connected symbol usbSymbol = "/proc/stb/lcd/symbol_usb" if fileExists(usbSymbol): USBState = 0 busses = usb.busses() if config.lcd.mode.value == '1': for bus in busses: devices = bus.devices for dev in devices: if dev.deviceClass != 9 and dev.deviceClass != 2 and dev.idVendor > 0: # print ' ' # print "Device:", dev.filename # print " Number:", dev.deviceClass # print " idVendor: %d (0x%04x)" % (dev.idVendor, dev.idVendor) # print " idProduct: %d (0x%04x)" % (dev.idProduct, dev.idProduct) USBState = 1 break open(usbSymbol, "w").write(str(USBState)) self.timer.startLongTimer(30)
def adapterAvailable(self): # Box has an adapter configured and active for adapter in ("eth0", "eth1", "wlan0", "wlan1", "wlan2", "wlan3", "ra0"): if "addr" in about.getIfConfig(adapter): print("[OnlineUpdateCheck][adapterAvailable] PASSED") return True print("[OnlineUpdateCheck][adapterAvailable] FAILED") return False
def getFeedSatus(self): status = '1' if getImageType() == 'developer': config.softwareupdate.updateisunstable.setValue(status) return 'stable' trafficLight = 'unknown' if about.getIfConfig('eth0').has_key('addr') or about.getIfConfig('eth1').has_key('addr') or about.getIfConfig('wlan0').has_key('addr') or about.getIfConfig('ra0').has_key('addr'): try: req = urllib2.Request('http://openvix.co.uk/TrafficLightState.php') d = urllib2.urlopen(req) trafficLight = d.read() except urllib2.HTTPError, err: print 'ERROR:',err trafficLight = err.code except urllib2.URLError, err: print 'ERROR:',err.reason[0] trafficLight = err.reason[0]
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig("eth0") if eth0.has_key("addr"): self.AboutText += _("IP:") + "\t" + eth0["addr"] + "\n" if eth0.has_key("netmask"): self.AboutText += _("Netmask:") + "\t" + eth0["netmask"] + "\n" if eth0.has_key("hwaddr"): self.AboutText += _("MAC:") + "\t" + eth0["hwaddr"] + "\n" self.iface = "eth0" eth1 = about.getIfConfig("eth1") if eth1.has_key("addr"): self.AboutText += _("IP:") + "\t" + eth1["addr"] + "\n" if eth1.has_key("netmask"): self.AboutText += _("Netmask:") + "\t" + eth1["netmask"] + "\n" if eth1.has_key("hwaddr"): self.AboutText += _("MAC:") + "\t" + eth1["hwaddr"] + "\n" self.iface = "eth1" ra0 = about.getIfConfig("ra0") if ra0.has_key("addr"): self.AboutText += _("IP:") + "\t" + ra0["addr"] + "\n" if ra0.has_key("netmask"): self.AboutText += _("Netmask:") + "\t" + ra0["netmask"] + "\n" if ra0.has_key("hwaddr"): self.AboutText += _("MAC:") + "\t" + ra0["hwaddr"] + "\n" self.iface = "ra0" wlan0 = about.getIfConfig("wlan0") if wlan0.has_key("addr"): self.AboutText += _("IP:") + "\t" + wlan0["addr"] + "\n" if wlan0.has_key("netmask"): self.AboutText += _("Netmask:") + "\t" + wlan0["netmask"] + "\n" if wlan0.has_key("hwaddr"): self.AboutText += _("MAC:") + "\t" + wlan0["hwaddr"] + "\n" self.iface = "wlan0" rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" hostname = file("/proc/sys/kernel/hostname").read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def __init__(self, session, iface, plugin_path): Screen.__init__(self, session) self.skin_path = plugin_path self.session = session self.iface = iface if self.iface is None: eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.iface = 'eth0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.iface = 'wlan0' self.networklist = None self.device = None self.mounts = None self.expanded = [] self.cache_ttl = 604800 self.cache_file = '/etc/enigma2/networkbrowser.cache' self['key_red'] = StaticText(_('Close')) self['key_green'] = StaticText(_('Mounts management')) self['key_yellow'] = StaticText(_('Rescan')) self['key_blue'] = StaticText(_('Expert')) self['infotext'] = StaticText(_('Press OK to mount!')) self['shortcuts'] = ActionMap( ['ShortcutActions', 'WizardActions'], { 'ok': self.go, 'back': self.close, 'red': self.close, 'green': self.keyGreen, 'yellow': self.keyYellow, 'blue': self.keyBlue }) self.list = [] self.statuslist = [] self.listindex = 0 self['list'] = List(self.list) self['list'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.startRun) self.onShown.append(self.setWindowTitle) self.onClose.append(self.cleanup) self.Timer = eTimer() self.Timer.callback.append(self.TimerFire)
def createscreen(self): self.AboutText = '' self.iface = 'eth0' eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _('IP:') + '\t' + eth0['addr'] + '\n' if eth0.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + eth0['netmask'] + '\n' if eth0.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + eth0['hwaddr'] + '\n' self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.AboutText += _('IP:') + '\t' + eth1['addr'] + '\n' if eth1.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + eth1['netmask'] + '\n' if eth1.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + eth1['hwaddr'] + '\n' self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.AboutText += _('IP:') + '\t' + ra0['addr'] + '\n' if ra0.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + ra0['netmask'] + '\n' if ra0.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + ra0['hwaddr'] + '\n' self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _('IP:') + '\t' + wlan0['addr'] + '\n' if wlan0.has_key('netmask'): self.AboutText += _( 'Netmask:') + '\t' + wlan0['netmask'] + '\n' if wlan0.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + wlan0['hwaddr'] + '\n' self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += '\n' + _('Bytes received:') + '\t' + rx_bytes + '\n' self.AboutText += _('Bytes sent:') + '\t' + tx_bytes + '\n' hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += '\n' + _('Hostname:') + '\t' + hostname + '\n' self['AboutScrollLabel'] = ScrollLabel(self.AboutText)
def getFeedStatus(self): status = '1' trafficLight = 'stable' if getImageType() != 'rubbish': status = '0' config.softwareupdate.updateisunstable.setValue(status) return 'stable' trafficLight = 'unknown' if about.getIfConfig('eth0').has_key('addr') or about.getIfConfig('eth1').has_key('addr') or about.getIfConfig('wlan0').has_key('addr') or about.getIfConfig('ra0').has_key('addr'): try: print '[OnlineVersionCheck] Checking feeds state' req = urllib2.Request('http://openvix.co.uk/TrafficLightState.php') d = urllib2.urlopen(req) trafficLight = d.read() except urllib2.HTTPError, err: print '[OnlineVersionCheck] ERROR:',err trafficLight = err.code except urllib2.URLError, err: print '[OnlineVersionCheck] ERROR:',err.reason[0] trafficLight = err.reason[0]
def getFeedSatus(self): status = '1' if getImageType() != 'release': config.softwareupdate.updateisunstable.setValue(status) return 'stable' trafficLight = 'unknown' if about.getIfConfig('eth0').has_key('addr') or about.getIfConfig( 'eth1').has_key('addr') or about.getIfConfig('wlan0').has_key( 'addr') or about.getIfConfig('ra0').has_key('addr'): try: req = urllib2.Request( 'http://openvix.co.uk/TrafficLightState.php') d = urllib2.urlopen(req) trafficLight = d.read() except urllib2.HTTPError, err: print 'ERROR:', err trafficLight = err.code except urllib2.URLError, err: print 'ERROR:', err.reason[0] trafficLight = err.reason[0]
def createscreen(self): self.AboutText = '' self.iface = 'eth0' eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _('IP:') + '\t' + eth0['addr'] + '\n' if eth0.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + eth0['netmask'] + '\n' if eth0.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + eth0['hwaddr'] + '\n' self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.AboutText += _('IP:') + '\t' + eth1['addr'] + '\n' if eth1.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + eth1['netmask'] + '\n' if eth1.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + eth1['hwaddr'] + '\n' self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.AboutText += _('IP:') + '\t' + ra0['addr'] + '\n' if ra0.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + ra0['netmask'] + '\n' if ra0.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + ra0['hwaddr'] + '\n' self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _('IP:') + '\t' + wlan0['addr'] + '\n' if wlan0.has_key('netmask'): self.AboutText += _('Netmask:') + '\t' + wlan0['netmask'] + '\n' if wlan0.has_key('hwaddr'): self.AboutText += _('MAC:') + '\t' + wlan0['hwaddr'] + '\n' self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += '\n' + _('Bytes received:') + '\t' + rx_bytes + '\n' self.AboutText += _('Bytes sent:') + '\t' + tx_bytes + '\n' hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += '\n' + _('Hostname:') + '\t' + hostname + '\n' self['AboutScrollLabel'] = ScrollLabel(self.AboutText)
def startListening(): global isListening if isListening: return True try: network = about.getIfConfig("eth0") or about.getIfConfig( "eth1") or about.getIfConfig("wlan0") if not network or not "addr" in network: return False sys.argv = [] # debugpy.listen crashes without this import debugpy debugpy.listen( (network["addr"], config.plugins.debugger.debugpy_port.value)) isListening = True print("[PythonDebug] Debug server listening on %s:%d" % (network["addr"], config.plugins.debugger.debugpy_port.value)) return True except Exception as error: print("[PythonDebug] Failed to start debug server %s" % error) return False
def createip(objelt): #self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): ownip = eth0['addr'] #self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): ownip = eth1['addr'] #self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): ownip = ra0['addr'] #self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): ownip = wlan0['addr'] #self.iface = 'wlan0' return ownip
def __init__(self, session, iface, plugin_path): Screen.__init__(self, session) self.skin_path = plugin_path self.session = session self.iface = iface if self.iface is None: eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.iface = 'eth0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.iface = 'wlan0' self.networklist = None self.device = None self.mounts = None self.expanded = [] self.cache_ttl = 604800 self.cache_file = '/etc/enigma2/networkbrowser.cache' self['key_red'] = StaticText(_('Close')) self['key_green'] = StaticText(_('Mounts management')) self['key_yellow'] = StaticText(_('Rescan')) self['key_blue'] = StaticText(_('Expert')) self['infotext'] = StaticText(_('Press OK to mount!')) self['shortcuts'] = ActionMap(['ShortcutActions', 'WizardActions'], {'ok': self.go, 'back': self.close, 'red': self.close, 'green': self.keyGreen, 'yellow': self.keyYellow, 'blue': self.keyBlue}) self.list = [] self.statuslist = [] self.listindex = 0 self['list'] = List(self.list) self['list'].onSelectionChanged.append(self.selectionChanged) self.onLayoutFinish.append(self.startRun) self.onShown.append(self.setWindowTitle) self.onClose.append(self.cleanup) self.Timer = eTimer() self.Timer.callback.append(self.TimerFire)
def addIfList(self, ifaceName): prevLinkState = ifaceName in self.linkState and self.linkState[ ifaceName] self.linkState[ifaceName] = False iface = about.getIfConfig(ifaceName) if 'addr' in iface: self.linkState[ifaceName] = self.getLinkState(ifaceName, iface) self.list.add( self.makeNetworkHeadEntry( _("Network:"), iNetwork.getFriendlyAdapterName(ifaceName), _("Link:"), self.linkIcons[self.linkState[ifaceName]])) self.list.add(self.makeInfoEntry(_("IP:"), str(iface['addr']))) if 'netmask' in iface: self.list.add( self.makeInfoEntry(_("Netmask:"), str(iface['netmask']))) if 'brdaddr' in iface: self.list.add( self.makeInfoEntry(_("Broadcast:"), iface['brdaddr'])) if 'hwaddr' in iface: self.list.add(self.makeInfoEntry(_("MAC:"), iface['hwaddr'])) gateways = self.allGateways.get(ifaceName) if gateways: if len(gateways) == 1: gatewayLabel = _("Gateway:") elif len(gateways) > 1: gatewayLabel = _("Gateways") self.list.add( self.makeGwInfoEntry('', _("Gateway"), _("Destination"))) for gw in gateways: if gw["destination"] == "0.0.0.0": gw["destination"] = "default" self.list.add( self.makeGwInfoEntry(gatewayLabel, gw["gateway"], gw["destination"])) gatewayLabel = None transferredData = self.allTransferredData.get(ifaceName) if transferredData: self.list.add( self.makeInfoEntry( _("Bytes in / out:"), ' / '.join([str(s) for s in transferredData]))) self.loadWanIfStatusModule(ifaceName) if iNetwork.isWirelessInterface(ifaceName): self.addWirelessInfo(ifaceName)
def getLanStatusMsg(self): eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): text11 = _("Your IP:") + "\t" + eth0['addr'] + "\n\n" if eth0.has_key('netmask'): text11 += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): text11 += _("Broadcast:") + "\t" + eth0['brdaddr'] + "\n" if eth0.has_key('hwaddr'): text11 += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" try: text1 = _("Your %s %s is now ready to be used.\n\nYour internet connection is working now.\n\n") % (getMachineBrand(), getMachineName()) text2 = _("Please press OK to continue.") return text1 + text11 +"\n" + text2 except: text1 = _("Your %s %s is now ready to be used.\n\nYour internet connection is not working now.\n\n") % (getMachineBrand(), getMachineName()) text2 = _("Please press OK to continue.") return text1 + "\n" + text2
def getLanStatusMsg(self): eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): text11 = _("Your IP:") + "\t" + eth0['addr'] + "\n\n" if eth0.has_key('netmask'): text11 += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): text11 += _("Gateway:") + "\t" + eth0['brdaddr'] + "\n" if eth0.has_key('hwaddr'): text11 += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" try: text1 = _("Your %s %s is now ready to be used.\n\nYour internet connection is working now.\n\n") % (getMachineBrand(), getMachineName()) text2 = _("Please press OK to continue.") return text1 + text11 +"\n" + text2 except: text1 = _("Your %s %s is now ready to be used.\n\nYour internet connection is not working now.\n\n") % (getMachineBrand(), getMachineName()) text2 = _("Please press OK to continue.") return text1 + "\n" + text2
def JobTask(self): # Network state symbol netSymbol = "/proc/stb/lcd/symbol_network" if fileExists(netSymbol): linkUp = 0 if config.lcd.mode.value == '1': for ifName in iNetwork.getInstalledAdapters(): ifState = about.getIfConfig(ifName) if ( 'flags' in ifState and ifState['flags'].get('up') and ifState['flags'].get('running') ): linkUp = 1 break open(netSymbol, "w").write(str(linkUp)) # USB devices connected symbol usbSymbol = "/proc/stb/lcd/symbol_usb" if fileExists(usbSymbol): USBState = 0 busses = usb.busses() if config.lcd.mode.value == '1': for bus in busses: devices = bus.devices for dev in devices: if dev.deviceClass != 9 and dev.deviceClass != 2 and dev.idVendor > 0: # print ' ' # print "Device:", dev.filename # print " Number:", dev.deviceClass # print " idVendor: %d (0x%04x)" % (dev.idVendor, dev.idVendor) # print " idProduct: %d (0x%04x)" % (dev.idProduct, dev.idProduct) USBState = 1 break open(usbSymbol, "w").write(str(USBState)) self.timer.startLongTimer(30)
def addIfList(self, ifaceName): prevLinkState = ifaceName in self.linkState and self.linkState[ifaceName] self.linkState[ifaceName] = False iface = about.getIfConfig(ifaceName) if 'addr' in iface: self.linkState[ifaceName] = self.getLinkState(ifaceName, iface) self.list.add(self.makeNetworkHeadEntry(_("Network:"), iNetwork.getFriendlyAdapterName(ifaceName), _("Link:"), self.linkIcons[self.linkState[ifaceName]])) self.list.add(self.makeInfoEntry(_("IP:"), str(iface['addr']))) if 'netmask' in iface: self.list.add(self.makeInfoEntry(_("Netmask:"), str(iface['netmask']))) if 'brdaddr' in iface: self.list.add(self.makeInfoEntry(_("Broadcast:"), iface['brdaddr'])) if 'hwaddr' in iface: self.list.add(self.makeInfoEntry(_("MAC:"), iface['hwaddr'])) gateways = self.allGateways.get(ifaceName) if gateways: if len(gateways) == 1: gatewayLabel = _("Gateway:") elif len(gateways) > 1: gatewayLabel = _("Gateways") self.list.add(self.makeGwInfoEntry('', _("Gateway"), _("Destination"))) for gw in gateways: if gw["destination"] == "0.0.0.0": gw["destination"] = "default" self.list.add(self.makeGwInfoEntry(gatewayLabel, gw["gateway"], gw["destination"])) gatewayLabel = None transferredData = self.allTransferredData.get(ifaceName) if transferredData: self.list.add(self.makeInfoEntry(_("Bytes in / out:"), ' / '.join([str(s) for s in transferredData]))) self.loadWanIfStatusModule(ifaceName) if iNetwork.isWirelessInterface(ifaceName): self.addWirelessInfo(ifaceName)
def createscreen(self): def netspeed(): netspeed="" for line in popen('ethtool eth0 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed="" for line in popen('ethtool eth1 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.AboutText += _("IP:") + "\t\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t\t" + eth0['hwaddr'] + "\n" self.AboutText += _("Network Speed:") + "\t\t" + netspeed() + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.AboutText += _("IP:") + "\t\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t\t" + eth1['netmask'] + "\n" if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t\t" + eth1['hwaddr'] + "\n" self.AboutText += _("Network Speed:") + "\t\t" + netspeed_eth1() + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.AboutText += _("IP:") + "\t\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t\t" + ra0['netmask'] + "\n" if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.AboutText += _("IP:") + "\t\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if wlan1.has_key('addr'): self.AboutText += _("IP:") + "\t\t" + wlan1['addr'] + "\n" if wlan1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t\t" + wlan1['netmask'] + "\n" if wlan1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t\t" + wlan1['hwaddr'] + "\n" self.iface = 'wlan1' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t\t" + tx_bytes + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): def netspeed(): netspeed = '' for line in popen('ethtool eth0 |grep Speed', 'r'): line = line.strip().split(':') line = line[1].replace(' ', '') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed = '' for line in popen('ethtool eth1 |grep Speed', 'r'): line = line.strip().split(':') line = line[1].replace(' ', '') netspeed += line return str(netspeed) self.AboutText = '' self.iface = 'eth0' eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += '{:<35}'.format( _('Interface:')) + '\t' + ' /dev/' + eth0['ifname'] + '\n' self.AboutText += '{:<35}'.format( _('IP:')) + '\t' + eth0['addr'] + '\n' if eth0.has_key('netmask'): self.AboutText += '{:<35}'.format( _('Netmask:')) + '\t' + eth0['netmask'] + '\n' if eth0.has_key('hwaddr'): self.AboutText += '{:<35}'.format( _('MAC:')) + '\t' + eth0['hwaddr'] + '\n' self.AboutText += '{:<35}'.format( _('Network Speed:')) + '\t' + netspeed() + '\n' self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += '{:<35}'.format( _('Interface:')) + '\t' + ' /dev/' + eth1['ifname'] + '\n' self.AboutText += '{:<35}'.format( _('IP:')) + '\t' + eth1['addr'] + '\n' if eth1.has_key('netmask'): self.AboutText += '{:<35}'.format( _('Netmask:')) + '\t' + eth1['netmask'] + '\n' if eth1.has_key('hwaddr'): self.AboutText += '{:<35}'.format( _('MAC:')) + '\t' + eth1['hwaddr'] + '\n' self.AboutText += '{:<35}'.format( _('Network Speed:')) + '\t' + netspeed_eth1() + '\n' self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += '{:<35}'.format( _('Interface:')) + '\t' + ' /dev/' + ra0['ifname'] + '\n' self.AboutText += '{:<35}'.format( _('IP:')) + '\t' + ra0['addr'] + '\n' if ra0.has_key('netmask'): self.AboutText += '{:<35}'.format( _('Netmask:')) + '\t' + ra0['netmask'] + '\n' if ra0.has_key('hwaddr'): self.AboutText += '{:<35}'.format( _('MAC:')) + '\t' + ra0['hwaddr'] + '\n' self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += '{:<35}'.format( _('Interface:')) + '\t' + ' /dev/' + wlan0['ifname'] + '\n' self.AboutText += '{:<35}'.format( _('IP:')) + '\t' + wlan0['addr'] + '\n' if wlan0.has_key('netmask'): self.AboutText += '{:<35}'.format( _('Netmask:')) + '\t' + wlan0['netmask'] + '\n' if wlan0.has_key('hwaddr'): self.AboutText += '{:<35}'.format( _('MAC:')) + '\t' + wlan0['hwaddr'] + '\n' self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if wlan1.has_key('addr'): if wlan1.has_key('ifname'): self.AboutText += '{:<35}'.format( _('Interface:')) + '\t' + ' /dev/' + wlan1['ifname'] + '\n' self.AboutText += '{:<35}'.format( _('IP:')) + '\t' + wlan1['addr'] + '\n' if wlan1.has_key('netmask'): self.AboutText += '{:<35}'.format( _('Netmask:')) + '\t' + wlan1['netmask'] + '\n' if wlan1.has_key('hwaddr'): self.AboutText += '{:<35}'.format( _('MAC:')) + '\t' + wlan1['hwaddr'] + '\n' self.iface = 'wlan1' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += '\n' + '{:<35}'.format( _('Bytes received:')) + '\t' + rx_bytes + '\n' self.AboutText += '{:<35}'.format( _('Bytes sent:')) + '\t' + tx_bytes + '\n' hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += '\n' + '{:<35}'.format( _('Hostname:')) + '\t' + hostname + '\n' self['AboutScrollLabel'] = ScrollLabel(self.AboutText)
def populate(self): def netspeed(): netspeed="" for line in popen('ethtool eth0 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed="" for line in popen('ethtool eth1 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) def netspeed_ra0(): netspeed="" for line in popen('iwconfig ra0 | grep Bit | cut -c 75-85','r'): line = line.strip() netspeed += line return str(netspeed) def netspeed_wlan0(): netspeed="" for line in popen('iwconfig wlan0 | grep Bit | cut -c 75-85','r'): line = line.strip() netspeed += line return str(netspeed) def netspeed_wlan1(): netspeed="" for line in popen('iwconfig wlan1 | grep Bit | cut -c 75-85','r'): line = line.strip() netspeed += line return str(netspeed) def freeflash(): freeflash="" for line in popen("df -mh / | grep -v '^Filesystem' | awk '{print $4}'",'r'): line = line.strip() freeflash += line return str(freeflash) self["lab1"] = StaticText(_("openHDF")) self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc") model = None AboutText = "" self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc") AboutText += _("Model:\t%s %s - OEM Model: %s\n") % (getMachineBrand(), getMachineName(), getBrandOEM()) if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset:\tBCM%s") % about.getChipSetString() + "\n" cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'" cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'" try: res = popen(cmd).read() res2 = popen(cmd2).read() except: res = "" res2 = "" cpuMHz = "" bootloader = "" if path.exists('/sys/firmware/devicetree/base/bolt/tag'): f = open('/sys/firmware/devicetree/base/bolt/tag', 'r') bootloader = f.readline().replace('\x00', '').replace('\n', '') f.close() BootLoaderVersion = 0 try: if bootloader: AboutText += _("Bootloader:\t%s\n") % (bootloader) BootLoaderVersion = int(bootloader[1:]) except: BootLoaderVersion = 0 if getMachineBuild() in ('vusolo4k'): cpuMHz = " (1,5 GHz)" elif getMachineBuild() in ('u41','u42'): cpuMHz = " (1,0 GHz)" elif getMachineBuild() in ('vuuno4k','dm900','gb7252','dags7252'): cpuMHz = " (1,7 GHz)" elif getMachineBuild() in ('formuler1tc','formuler1','triplex'): cpuMHz = " (1,3 GHz)" elif getMachineBuild() in ('u5','u51','u52','u53','u5pvr','h9','sf8008','sf8008s','sf8008t','hd60',"hd61",'i55plus'): cpuMHz = " (1,6 GHz)" elif getMachineBuild() in ('sf5008','et13000','et1x000','hd52','hd51','sf4008','vs1500','h7','osmio4k'): try: import binascii f = open('/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb') clockfrequency = f.read() f.close() cpuMHz = "%s MHz" % str(round(int(binascii.hexlify(clockfrequency), 16)/1000000,1)) except: cpuMHz = "1,7 GHz" else: if path.exists('/proc/cpuinfo'): f = open('/proc/cpuinfo', 'r') temp = f.readlines() f.close() try: for lines in temp: lisp = lines.split(': ') if lisp[0].startswith('cpu MHz'): #cpuMHz = " (" + lisp[1].replace('\n', '') + " MHz)" cpuMHz = " (" + str(int(float(lisp[1].replace('\n', '')))) + " MHz)" break except: pass bogoMIPS = "" if res: cpuMHz = "" + res.replace("\n", "") + " MHz" if res2: bogoMIPS = "" + res2.replace("\n", "") if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'): AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n" else: AboutText += _("CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n" dMIPS = 0 if getMachineBuild() in ('vusolo4k'): dMIPS = "10.500" elif getMachineBuild() in ('hd52','hd51','sf4008','dm900','h7','gb7252','8100s'): dMIPS = "12.000" if getMachineBuild() in ('vusolo4k','hd51','hd52','sf4008','dm900','h7','gb7252','8100s'): AboutText += _("DMIPS:\t") + dMIPS + "\n" else: AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/sensors/temp/value'): f = open('/proc/stb/sensors/temp/value', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): if getBoxType() in ('mutant51', 'ax51', 'zgemmah7', 'e4hdultra'): tempinfo = "" else: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System Temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" tempinfo = "" if path.exists('/proc/stb/fp/temp_sensor_avs'): f = open('/proc/stb/fp/temp_sensor_avs', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/power/avs'): f = open('/proc/stb/power/avs', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" elif path.exists('/proc/hisi/msp/pm_cpu'): try: for line in open('/proc/hisi/msp/pm_cpu').readlines(): line = [x.strip() for x in line.strip().split(":")] if line[0] in ("Tsensor"): temp = line[1].split("=") temp = line[1].split(" ") tempinfo = temp[2] except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("CPU Temp:\t%s") % tempinfo.replace('\n', '').replace(' ','') + mark + "C\n" AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n" AboutText += _("HDF Version:\tV%s") % getImageVersion() + " Build #" + getImageBuild() + " based on " + getOEVersion() + "\n" AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString() + " (" + getBoxType() + ")" + "\n" imagestarted = "" bootname = '' if path.exists('/boot/bootname'): f = open('/boot/bootname', 'r') bootname = f.readline().split('=')[1] f.close() if SystemInfo["HasRootSubdir"]: image = find_rootfssubdir("STARTUP") AboutText += _("Selected Image:\t%s") % "STARTUP_" + image[-1:] + bootname + "\n" elif getMachineBuild() in ('gbmv200','cc1','sf8008','ustym4kpro','beyonwizv2',"viper4k"): if path.exists('/boot/STARTUP'): f = open('/boot/STARTUP', 'r') f.seek(5) image = f.read(4) if image == "emmc": image = "1" elif image == "usb0": f.seek(13) image = f.read(1) if image == "1": image = "2" elif image == "3": image = "3" elif image == "5": image = "4" elif image == "7": image = "5" f.close() if bootname: bootname = " (%s)" %bootname AboutText += _("Partition:\t%s") % "STARTUP_" + image + bootname + "\n" else: f = open('/boot/STARTUP', 'r') f.seek(22) image = f.read(1) f.close() if bootname: bootname = " (%s)" %bootname AboutText += _("Partition:\t%s") % "STARTUP_" + image + bootname + "\n" if path.isfile("/etc/issue"): version = open("/etc/issue").readlines()[-2].upper().strip()[:-6] if path.isfile("/etc/image-version"): build = self.searchString("/etc/image-version", "^build=") version = "%s #%s" % (version,build) AboutText += _("Image:\t%s") % version + "\n" string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32' gstcmd2 = os.system(gstcmd) #return (gstcmd2) AboutText += _("Drivers:\t%s") % driversdate + "\n" AboutText += _("GStreamer:\t%s") % about.getGStreamerVersionString() + "\n" AboutText += _("Python:\t%s\n") % about.getPythonVersionString() if path.exists('/boot/STARTUP'): #if getMachineBuild() in ('cc1','sf8008','sf8008s','sf8008t'): # os.system("tune2fs -l /dev/sda2 | grep 'Filesystem created:' | cut -d ' ' -f 9-13 > /tmp/flashdate" ) #else: # os.system("tune2fs -l /dev/sda1 | grep 'Filesystem created:' | cut -d ' ' -f 9-13 > /tmp/flashdate" ) #flashdate = open('/tmp/flashdate', 'r').read() #AboutText += _("Flashed:\t%s") % flashdate AboutText += _("Flashed:\tMultiboot active\n") else: AboutText += _("Flashed:\t%s\n") % about.getFlashDateString() AboutText += _("Free Flash:\t%s\n") % freeflash() AboutText += _("Skin:\t%s (%s x %s)\n") % (config.skin.primary_skin.value.split('/')[0], getDesktop(0).size().width(), getDesktop(0).size().height()) AboutText += _("Last update:\t%s") % getEnigmaVersionString() + " to Build #" + getImageBuild() + "\n" AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value AboutText += _("Network:") eth0 = about.getIfConfig('eth0') eth1 = about.getIfConfig('eth1') ra0 = about.getIfConfig('ra0') wlan0 = about.getIfConfig('wlan0') wlan1 = about.getIfConfig('wlan1') if eth0.has_key('addr'): for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + x[0] + ": " + x[1] + " (" + netspeed() + ")\n" elif eth1.has_key('addr'): for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + x[0] + ": " + x[1] + " (" + netspeed_eth1() + ")\n" elif ra0.has_key('addr'): for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_ra0() + ")\n" elif wlan0.has_key('addr'): for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_wlan0() + ")\n" elif wlan1.has_key('addr'): for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + x[0] + ": " + x[1] + " (~" + netspeed_wlan1() + ")\n" else: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + x[0] + ": " + x[1] + "\n" fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("Frontprocessor:\tVersion %s") % fp_version AboutText += fp_version + "\n" AboutLcdText = AboutText.replace('\t', ' ') self["AboutScrollLabel"] = ScrollLabel(AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') def nameserver(): nameserver="" i=0 for line in open('/etc/resolv.conf','r'): line = line.strip() if "nameserver" in line: i=i+1 nameserver += str(i) +".Nameserver" + ":\t" +line.strip().replace("nameserver ","")+"\n" return nameserver.strip() def domain(): domain="" for line in open('/etc/resolv.conf','r'): line = line.strip() if "domain" in line: domain +=line.strip().replace("domain ","") return domain else: domain="not set" return domain def gateway(): gateway="" for line in popen('ip route show'): line = line.strip() if "default via " in line: line = line.split(' ') line =line[2] return line else: line = "not set" return line def netspeed(): netspeed="" for line in popen('ethtool eth0 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed="" for line in popen('ethtool eth1 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth0['ifname'] + "\n") self.AboutText += _("NetSpeed:") + "\t" + netspeed() + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" self.AboutText += _("Gateway:") + "\t" + gateway() + "\n" self.AboutText += nameserver() + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): if eth0['brdaddr']=="0.0.0.0": self.AboutText += _('Broadcast:\t' + eth0['brdaddr'] + " (DHCP off)" + "\n") else: self.AboutText += _('Broadcast:\t' + eth0['brdaddr'] + "\n") self.AboutText += _("Domain:") + "\t" + domain() + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth1['ifname'] + "\n") self.AboutText += _("NetSpeed:") + "\t" + netspeed_eth1() + "\n" if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" self.AboutText += _("Gateway:") + "\t" + gateway() + "\n" self.AboutText += nameserver() + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if eth1.has_key('brdaddr'): if eth1['brdaddr']=="0.0.0.0": self.AboutText += _('Broadcast:\t' + eth1['brdaddr'] + " (DHCP off)" + "\n") else: self.AboutText += _('Broadcast:\t' + eth1['brdaddr'] + "\n") self.AboutText += _("Domain:") + "\t" + domain() + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if ra0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra0['brdaddr'] + "\n") if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan0['ifname'] + "\n") if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" self.AboutText += _("Gateway:") + "\t" + gateway() + "\n" self.AboutText += nameserver() + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): if wlan0['brdaddr']=="0.0.0.0": self.AboutText += _('Broadcast:\t' + wlan0['brdaddr'] + " (DHCP off)" + "\n") else: self.AboutText += _('Broadcast:\t' + wlan0['brdaddr'] + "\n") self.AboutText += _("Domain:") + "\t" + domain() + "\n" self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + ' (~' + str(int(rx_bytes)/1024/1024) + ' MB)' + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + ' (~' + str(int(tx_bytes)/1024/1024)+ ' MB)' + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def adapterAvailable(self): # Box has an adapter configured and active for adapter in ('eth0', 'eth1', 'wlan0', 'wlan1', 'wlan2', 'wlan3', 'ra0'): if about.getIfConfig(adapter).has_key('addr'): return True return False
def populate(self): def netspeed(): netspeed = "" for line in popen('ethtool eth0 |grep Speed', 'r'): line = line.strip().split(":") line = line[1].replace(' ', '') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed = "" for line in popen('ethtool eth1 |grep Speed', 'r'): line = line.strip().split(":") line = line[1].replace(' ', '') netspeed += line return str(netspeed) def netspeed_ra0(): netspeed = "" for line in popen('iwconfig ra0 | grep Bit | cut -c 20-30', 'r'): line = line.strip() netspeed += line return str(netspeed) def netspeed_wlan0(): netspeed = "" for line in popen('iwconfig wlan0 | grep Bit | cut -c 20-30', 'r'): line = line.strip() netspeed += line return str(netspeed) def netspeed_wlan1(): netspeed = "" for line in popen('iwconfig wlan1 | grep Bit | cut -c 20-30', 'r'): line = line.strip() netspeed += line return str(netspeed) def freeflash(): freeflash = "" for line in popen( "df -mh / | grep -v '^Filesystem' | awk '{print $4}'", 'r'): line = line.strip() freeflash += line return str(freeflash) self["lab1"] = StaticText(_("openHDF")) self["lab2"] = StaticText(_("Support at") + " www.HDFreaks.cc") model = None AboutText = "" self["lab2"] = StaticText(_("Support @") + " www.hdfreaks.cc") AboutText += _("Model:\t%s %s - OEM Model: %s\n") % ( getMachineBrand(), getMachineName(), getBrandOEM()) if path.exists('/proc/stb/info/chipset'): AboutText += _("Chipset:\t%s") % about.getChipSetString() + "\n" cmd = 'cat /proc/cpuinfo | grep "cpu MHz" -m 1 | awk -F ": " ' + "'{print $2}'" cmd2 = 'cat /proc/cpuinfo | grep "BogoMIPS" -m 1 | awk -F ": " ' + "'{print $2}'" try: res = popen(cmd).read() res2 = popen(cmd2).read() except: res = "" res2 = "" cpuMHz = "" bootloader = "" if path.exists('/sys/firmware/devicetree/base/bolt/tag'): f = open('/sys/firmware/devicetree/base/bolt/tag', 'r') bootloader = f.readline().replace('\x00', '').replace('\n', '') f.close() BootLoaderVersion = 0 try: if bootloader: AboutText += _("Bootloader:\t%s\n") % (bootloader) BootLoaderVersion = int(bootloader[1:]) except: BootLoaderVersion = 0 if getMachineBuild() in ('vusolo4k', 'gbx34k'): cpuMHz = " (1,5 GHz)" elif getMachineBuild() in ('u41', 'u42'): cpuMHz = " (1,0 GHz)" elif getMachineBuild() in ('vuuno4k', 'dm900', 'gb7252', 'dags7252'): cpuMHz = " (1,7 GHz)" elif getMachineBuild() in ('formuler1tc', 'formuler1', 'triplex'): cpuMHz = " (1,3 GHz)" elif getMachineBuild() in ('u5', 'u51', 'u52', 'u53', 'u5pvr', 'h9', 'sf8008', 'sf8008s', 'sf8008t', 'hd60', "hd61", 'i55plus'): cpuMHz = " (1,6 GHz)" elif getMachineBuild() in ('sf5008', 'et13000', 'et1x000', 'hd52', 'hd51', 'sf4008', 'vs1500', 'h7', 'osmio4k', 'osmio4kplus', 'osmini4k'): try: import binascii f = open( '/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency', 'rb') clockfrequency = f.read() f.close() cpuMHz = "%s MHz" % str( round( int(binascii.hexlify(clockfrequency), 16) // 1000000, 1)) except: cpuMHz = "1,7 GHz" else: if path.exists('/proc/cpuinfo'): f = open('/proc/cpuinfo', 'r') temp = f.readlines() f.close() try: for lines in temp: lisp = lines.split(': ') if lisp[0].startswith('cpu MHz'): #cpuMHz = " (" + lisp[1].replace('\n', '') + " MHz)" cpuMHz = " (" + str( int(float(lisp[1].replace('\n', '')))) + " MHz)" break except: pass bogoMIPS = "" if res: cpuMHz = "" + res.replace("\n", "") + " MHz" if res2: bogoMIPS = "" + res2.replace("\n", "") if getMachineBuild() in ('vusolo4k', 'hd51', 'hd52', 'sf4008', 'dm900', 'h7', 'gb7252', '8100s'): AboutText += _("CPU:\t%s") % about.getCPUString() + cpuMHz + "\n" else: AboutText += _( "CPU:\t%s") % about.getCPUString() + " " + cpuMHz + "\n" dMIPS = 0 if getMachineBuild() in ('vusolo4k'): dMIPS = "10.500" elif getMachineBuild() in ('hd52', 'hd51', 'sf4008', 'dm900', 'h7', 'gb7252', '8100s'): dMIPS = "12.000" if getMachineBuild() in ('vusolo4k', 'hd51', 'hd52', 'sf4008', 'dm900', 'h7', 'gb7252', '8100s'): AboutText += _("DMIPS:\t") + dMIPS + "\n" else: AboutText += _("BogoMIPS:\t%s") % bogoMIPS + "\n" tempinfo = "" if path.exists('/proc/stb/sensors/temp0/value'): f = open('/proc/stb/sensors/temp0/value', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/fp/temp_sensor'): f = open('/proc/stb/fp/temp_sensor', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/sensors/temp/value'): f = open('/proc/stb/sensors/temp/value', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("System Temp:\t%s") % tempinfo.replace( '\n', '').replace(' ', '') + mark + "C\n" tempinfo = "" if path.exists('/proc/stb/fp/temp_sensor_avs'): f = open('/proc/stb/fp/temp_sensor_avs', 'r') tempinfo = f.read() f.close() elif path.exists('/proc/stb/power/avs'): f = open('/proc/stb/power/avs', 'r') tempinfo = f.read() f.close() elif path.exists('/sys/devices/virtual/thermal/thermal_zone0/temp'): try: f = open('/sys/devices/virtual/thermal/thermal_zone0/temp', 'r') tempinfo = f.read() tempinfo = tempinfo[:-4] f.close() except: tempinfo = "" elif path.exists('/proc/hisi/msp/pm_cpu'): try: for line in open('/proc/hisi/msp/pm_cpu').readlines(): line = [x.strip() for x in line.strip().split(":")] if line[0] in ("Tsensor"): temp = line[1].split("=") temp = line[1].split(" ") tempinfo = temp[2] except: tempinfo = "" if tempinfo and int(tempinfo.replace('\n', '')) > 0: mark = str('\xc2\xb0') AboutText += _("CPU Temp:\t%s") % tempinfo.replace( '\n', '').replace(' ', '') + mark + "C\n" AboutText += _("Cores:\t%s") % about.getCpuCoresString() + "\n" AboutText += _("HDF Version:\tV%s") % getImageVersion( ) + " Build #" + getImageBuild() + " based on " + getOEVersion() + "\n" AboutText += _("Kernel (Box):\t%s") % about.getKernelVersionString( ) + " (" + getBoxType() + ")" + "\n" if path.isfile("/etc/issue"): version = open("/etc/issue").readlines()[-2].upper().strip()[:-6] if path.isfile("/etc/image-version"): build = self.searchString("/etc/image-version", "^build=") version = "%s #%s" % (version, build) AboutText += _("Image:\t%s") % version + "\n" imagestarted = "" bootname = '' if path.exists('/boot/bootname'): f = open('/boot/bootname', 'r') bootname = f.readline().split('=')[1] f.close() if SystemInfo["HasRootSubdir"]: image = find_rootfssubdir("STARTUP") AboutText += _("Selected Image:\t%s" ) % "STARTUP_" + image[-1:] + bootname + "\n" elif getMachineBuild() in ('gbmv200', 'cc1', 'sf8008', 'ustym4kpro', 'beyonwizv2', "viper4k"): if path.exists('/boot/STARTUP'): f = open('/boot/STARTUP', 'r') f.seek(5) image = f.read(4) if image == "emmc": image = "1" elif image == "usb0": f.seek(13) image = f.read(1) if image == "1": image = "2" elif image == "3": image = "3" elif image == "5": image = "4" elif image == "7": image = "5" f.close() if bootname: bootname = " (%s)" % bootname AboutText += _( "Partition:\t%s") % "STARTUP_" + image + bootname + "\n" else: f = open('/boot/STARTUP', 'r') f.seek(22) image = f.read(1) f.close() if bootname: bootname = " (%s)" % bootname AboutText += _( "Partition:\t%s") % "STARTUP_" + image + bootname + "\n" if SystemInfo["HaveMultiBoot"]: MyFlashDate = about.getFlashDateString() if path.isfile("/etc/filesystems"): AboutText += _("Flashed:\t%s") % MyFlashDate + "\n" #AboutText += _("Flashed:\tMultiboot active\n") else: AboutText += _("Flashed:\t%s\n") % about.getFlashDateString() string = getDriverDate() year = string[0:4] month = string[4:6] day = string[6:8] driversdate = '-'.join((year, month, day)) gstcmd = 'opkg list-installed | grep "gstreamer1.0 -" | cut -c 16-32' gstcmd2 = os.system(gstcmd) #return (gstcmd2) AboutText += _("Drivers:\t%s") % driversdate + "\n" AboutText += _( "GStreamer:\t%s") % about.getGStreamerVersionString() + "\n" AboutText += _("Python:\t%s\n") % about.getPythonVersionString() AboutText += _("Free Flash:\t%s\n") % freeflash() AboutText += _("Skin:\t%s (%s x %s)\n") % ( config.skin.primary_skin.value.split('/')[0], getDesktop(0).size().width(), getDesktop(0).size().height()) AboutText += _("Last update:\t%s") % getEnigmaVersionString( ) + " to Build #" + getImageBuild() + "\n" AboutText += _("E2 (re)starts:\t%s\n") % config.misc.startCounter.value AboutText += _("Uptime") + ":\t" + about.getBoxUptime() + "\n" if SystemInfo["WakeOnLAN"]: if fileCheck("/proc/stb/power/wol"): WOLmode = open("/proc/stb/power/wol").read()[:-1] if fileCheck("/proc/stb/fp/wol"): WOLmode = open("/proc/stb/fp/wol").read()[:-1] AboutText += _("WakeOnLAN:\t%s\n") % WOLmode AboutText += _("Network:") eth0 = about.getIfConfig('eth0') eth1 = about.getIfConfig('eth1') ra0 = about.getIfConfig('ra0') wlan0 = about.getIfConfig('wlan0') wlan1 = about.getIfConfig('wlan1') if 'addr' in eth0: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + str(x[0]) + ": " + str( x[1]) + " (" + netspeed() + ")\n" elif 'addr' in eth1: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + str(x[0]) + ": " + str( x[1]) + " (" + netspeed_eth1() + ")\n" elif 'addr' in ra0: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + str(x[0]) + ": " + str( x[1]) + " (~" + netspeed_ra0() + ")\n" elif 'addr' in wlan0: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + str(x[0]) + ": " + str( x[1]) + " (~" + netspeed_wlan0() + ")\n" elif 'addr' in wlan1: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + str(x[0]) + ": " + str( x[1]) + " (~" + netspeed_wlan1() + ")\n" else: for x in about.GetIPsFromNetworkInterfaces(): AboutText += "\t" + str(x[0]) + ": " + str(x[1]) + "\n" fp_version = getFPVersion() if fp_version is None: fp_version = "" elif fp_version != 0: fp_version = _("Frontprocessor:\tVersion %s") % fp_version AboutText += fp_version + "\n" AboutLcdText = AboutText.replace('\t', ' ') self["AboutScrollLabel"] = ScrollLabel(AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth0['brdaddr'] + "\n") if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth1['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if eth1.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth1['brdaddr'] + "\n") if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if ra0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra0['brdaddr'] + "\n") if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + wlan0['brdaddr'] + "\n") if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + ' (~' + str(int(rx_bytes)/1024/1024) + ' MB)' + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + ' (~' + str(int(tx_bytes)/1024/1024)+ ' MB)' + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): def netspeed(): netspeed="" for line in popen('ethtool eth0 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed="" for line in popen('ethtool eth1 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += '{:<35}'.format(_('Interface:')) + "\t" + " /dev/" + eth0['ifname'] + "\n" self.AboutText += '{:<35}'.format(_("IP:")) + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += '{:<35}'.format(_("Netmask:")) + "\t" + eth0['netmask'] + "\n" if eth0.has_key('hwaddr'): self.AboutText += '{:<35}'.format(_("MAC:")) + "\t" + eth0['hwaddr'] + "\n" self.AboutText += '{:<35}'.format(_("Network Speed:")) + "\t" + netspeed() + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += '{:<35}'.format(_('Interface:')) + "\t" + " /dev/" + eth1['ifname'] + "\n" self.AboutText += '{:<35}'.format(_("IP:")) + "\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += '{:<35}'.format(_("Netmask:")) + "\t" + eth1['netmask'] + "\n" if eth1.has_key('hwaddr'): self.AboutText += '{:<35}'.format(_("MAC:")) + "\t" + eth1['hwaddr'] + "\n" self.AboutText += '{:<35}'.format(_("Network Speed:")) + "\t" + netspeed_eth1() + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += '{:<35}'.format(_('Interface:')) + "\t" + " /dev/" + ra0['ifname'] + "\n" self.AboutText += '{:<35}'.format(_("IP:")) + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += '{:<35}'.format(_("Netmask:")) + "\t" + ra0['netmask'] + "\n" if ra0.has_key('hwaddr'): self.AboutText += '{:<35}'.format(_("MAC:")) + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += '{:<35}'.format(_('Interface:')) + "\t" + " /dev/" + wlan0['ifname'] + "\n" self.AboutText += '{:<35}'.format(_("IP:")) + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += '{:<35}'.format(_("Netmask:")) + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += '{:<35}'.format(_("MAC:")) + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if wlan1.has_key('addr'): if wlan1.has_key('ifname'): self.AboutText += '{:<35}'.format(_('Interface:')) + "\t" + " /dev/" + wlan1['ifname'] + "\n" self.AboutText += '{:<35}'.format(_("IP:")) + "\t" + wlan1['addr'] + "\n" if wlan1.has_key('netmask'): self.AboutText += '{:<35}'.format(_("Netmask:")) + "\t" + wlan1['netmask'] + "\n" if wlan1.has_key('hwaddr'): self.AboutText += '{:<35}'.format(_("MAC:")) + "\t" + wlan1['hwaddr'] + "\n" self.iface = 'wlan1' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + '{:<35}'.format(_("Bytes received:")) + "\t" + rx_bytes + "\n" self.AboutText += '{:<35}'.format(_("Bytes sent:")) + "\t" + tx_bytes + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + '{:<35}'.format(_("Hostname:")) + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): def netspeed(): netspeed = "" for line in popen('ethtool eth0 |grep Speed', 'r'): line = line.strip().split(":") line = line[1].replace(' ', '') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed = "" for line in popen('ethtool eth1 |grep Speed', 'r'): line = line.strip().split(":") line = line[1].replace(' ', '') netspeed += line return str(netspeed) self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if 'addr' in eth0: self.AboutText += _("IP:") + "\t\t" + eth0['addr'] + "\n" if 'netmask' in eth0: self.AboutText += _( "Netmask:") + "\t\t" + eth0['netmask'] + "\n" if 'hwaddr' in eth0: self.AboutText += _("MAC:") + "\t\t" + eth0['hwaddr'] + "\n" self.AboutText += _("Network Speed:") + "\t\t" + netspeed() + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if 'addr' in eth1: self.AboutText += _("IP:") + "\t\t" + eth1['addr'] + "\n" if 'netmask' in eth1: self.AboutText += _( "Netmask:") + "\t\t" + eth1['netmask'] + "\n" if 'hwaddr' in eth1: self.AboutText += _("MAC:") + "\t\t" + eth1['hwaddr'] + "\n" self.AboutText += _( "Network Speed:") + "\t\t" + netspeed_eth1() + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if 'addr' in ra0: self.AboutText += _("IP:") + "\t\t" + ra0['addr'] + "\n" if 'netmask' in ra0: self.AboutText += _( "Netmask:") + "\t\t" + ra0['netmask'] + "\n" if 'hwaddr' in ra0: self.AboutText += _("MAC:") + "\t\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if 'addr' in wlan0: self.AboutText += _("IP:") + "\t\t" + wlan0['addr'] + "\n" if 'netmask' in wlan0: self.AboutText += _( "Netmask:") + "\t\t" + wlan0['netmask'] + "\n" if 'hwaddr' in wlan0: self.AboutText += _("MAC:") + "\t\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if 'addr' in wlan1: self.AboutText += _("IP:") + "\t\t" + wlan1['addr'] + "\n" if 'netmask' in wlan1: self.AboutText += _( "Netmask:") + "\t\t" + wlan1['netmask'] + "\n" if 'hwaddr' in wlan1: self.AboutText += _("MAC:") + "\t\t" + wlan1['hwaddr'] + "\n" self.iface = 'wlan1' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t\t" + tx_bytes + "\n" hostname = open('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if 'addr' in eth0: self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if 'netmask' in eth0: self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if 'hwaddr' in eth0: self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if 'addr' in eth1: self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if 'netmask' in eth1: self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if 'hwaddr' in eth1: self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if 'addr' in ra0: self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if 'netmask' in ra0: self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if 'hwaddr' in ra0: self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if 'addr' in wlan0: self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if 'netmask' in wlan0: self.AboutText += _("Netmask:") + "\t" + wlan0['netmask'] + "\n" if 'hwaddr' in wlan0: self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan3 = about.getIfConfig('wlan3') if 'addr' in wlan3: self.AboutText += _("IP:") + "\t" + wlan3['addr'] + "\n" if 'netmask' in wlan3: self.AboutText += _("Netmask:") + "\t" + wlan3['netmask'] + "\n" if 'hwaddr' in wlan3: self.AboutText += _("MAC:") + "\t" + wlan3['hwaddr'] + "\n" self.iface = 'wlan3' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" self.AboutText += _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" isp = geolocation.get("isp", None) isporg = geolocation.get("org", None) self.AboutText += "\n" if isp is not None: if isporg is not None: self.AboutText += _("ISP: ") + isp + " " + "(" + isporg + ")" + "\n" else: self.AboutText += _("ISP: ") + isp + "\n" mobile = geolocation.get("mobile", False) if mobile is not False: self.AboutText += _("Mobile: ") + _("Yes") + "\n" else: self.AboutText += _("Mobile: ") + _("No") + "\n" proxy = geolocation.get("proxy", False) if proxy is not False: self.AboutText += _("Proxy: ") + _("Yes") + "\n" else: self.AboutText += _("Proxy: ") + _("No") + "\n" publicip = geolocation.get("query", None) if str(publicip) != "": self.AboutText += _("Public IP: ") + str(publicip) + "\n" self.AboutText += "\n" self.console = Console() self.console.ePopen('ethtool %s' % self.iface, self.SpeedFinished)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig("eth0") if "addr" in eth0: self.AboutText += _("IP:") + "\t" + eth0["addr"] + "\n" if "netmask" in eth0: self.AboutText += _("Netmask:") + "\t" + eth0["netmask"] + "\n" if "hwaddr" in eth0: self.AboutText += _("MAC:") + "\t" + eth0["hwaddr"] + "\n" self.iface = "eth0" eth1 = about.getIfConfig("eth1") if "addr" in eth1: self.AboutText += _("IP:") + "\t" + eth1["addr"] + "\n" if "netmask" in eth1: self.AboutText += _("Netmask:") + "\t" + eth1["netmask"] + "\n" if "hwaddr" in eth1: self.AboutText += _("MAC:") + "\t" + eth1["hwaddr"] + "\n" self.iface = "eth1" ra0 = about.getIfConfig("ra0") if "addr" in ra0: self.AboutText += _("IP:") + "\t" + ra0["addr"] + "\n" if "netmask" in ra0: self.AboutText += _("Netmask:") + "\t" + ra0["netmask"] + "\n" if "hwaddr" in ra0: self.AboutText += _("MAC:") + "\t" + ra0["hwaddr"] + "\n" self.iface = "ra0" wlan0 = about.getIfConfig("wlan0") if "addr" in wlan0: self.AboutText += _("IP:") + "\t" + wlan0["addr"] + "\n" if "netmask" in wlan0: self.AboutText += _( "Netmask:") + "\t" + wlan0["netmask"] + "\n" if "hwaddr" in wlan0: self.AboutText += _("MAC:") + "\t" + wlan0["hwaddr"] + "\n" self.iface = "wlan0" wlan3 = about.getIfConfig("wlan3") if "addr" in wlan3: self.AboutText += _("IP:") + "\t" + wlan3["addr"] + "\n" if "netmask" in wlan3: self.AboutText += _( "Netmask:") + "\t" + wlan3["netmask"] + "\n" if "hwaddr" in wlan3: self.AboutText += _("MAC:") + "\t" + wlan3["hwaddr"] + "\n" self.iface = "wlan3" rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + "\n" for line in popen("ethtool %s |grep Speed" % self.iface, "r"): line = line.strip().split(":") line = line[1].replace(" ", "") if "Speed:" in line: self.AboutText += _("Speed:") + "\t" + line + _("Mb/s") hostname = open("/proc/sys/kernel/hostname").read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"].setText(self.AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth0['brdaddr'] + "\n") if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth1['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if eth1.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth1['brdaddr'] + "\n") if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' eth2 = about.getIfConfig('eth2') if eth2.has_key('addr'): if eth2.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth2['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth2['addr'] + "\n" if eth2.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth2['netmask'] + "\n" if eth2.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth2['brdaddr'] + "\n") if eth2.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth2['hwaddr'] + "\n" self.iface = 'eth2' eth3 = about.getIfConfig('eth3') if eth3.has_key('addr'): if eth3.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth3['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth3['addr'] + "\n" if eth3.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth3['netmask'] + "\n" if eth3.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth3['brdaddr'] + "\n") if eth3.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth3['hwaddr'] + "\n" self.iface = 'eth3' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if ra0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra0['brdaddr'] + "\n") if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' ra1 = about.getIfConfig('ra1') if ra1.has_key('addr'): if ra1.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra1['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra1['addr'] + "\n" if ra1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra1['netmask'] + "\n" if ra1.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra1['brdaddr'] + "\n") if ra1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra1['hwaddr'] + "\n" self.iface = 'ra1' ra2 = about.getIfConfig('ra2') if ra2.has_key('addr'): if ra2.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra2['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra2['addr'] + "\n" if ra2.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra2['netmask'] + "\n" if ra2.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra2['brdaddr'] + "\n") if ra2.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra2['hwaddr'] + "\n" self.iface = 'ra2' ra3 = about.getIfConfig('ra3') if ra3.has_key('addr'): if ra3.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra3['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra3['addr'] + "\n" if ra3.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra3['netmask'] + "\n" if ra3.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra3['brdaddr'] + "\n") if ra3.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra3['hwaddr'] + "\n" self.iface = 'ra3' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + wlan0['brdaddr'] + "\n") if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' wlan1 = about.getIfConfig('wlan1') if wlan1.has_key('addr'): if wlan1.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan1['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + wlan1['addr'] + "\n" if wlan1.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan1['netmask'] + "\n" if wlan1.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + wlan1['brdaddr'] + "\n") if wlan1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan1['hwaddr'] + "\n" self.iface = 'wlan1' wlan2 = about.getIfConfig('wlan2') if wlan2.has_key('addr'): if wlan2.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan2['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + wlan2['addr'] + "\n" if wlan2.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan2['netmask'] + "\n" if wlan2.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + wlan2['brdaddr'] + "\n") if wlan2.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan2['hwaddr'] + "\n" self.iface = 'wlan2' wlan3 = about.getIfConfig('wlan3') if wlan3.has_key('addr'): if wlan3.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan3['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + wlan3['addr'] + "\n" if wlan3.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan3['netmask'] + "\n" if wlan3.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + wlan3['brdaddr'] + "\n") if wlan3.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan3['hwaddr'] + "\n" self.iface = 'wlan3' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _( "Bytes received:") + "\t" + rx_bytes + ' (~' + str( int(rx_bytes) / 1024 / 1024) + ' MB)' + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + ' (~' + str( int(tx_bytes) / 1024 / 1024) + ' MB)' + "\n" self.console = Console() self.console.ePopen('ethtool %s' % self.iface, self.SpeedFinished)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth0['addr'] + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth0['brdaddr'] + "\n") if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth0['hwaddr'] + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + eth1['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + eth1['addr'] + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + eth1['netmask'] + "\n" if eth1.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + eth1['brdaddr'] + "\n") if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + eth1['hwaddr'] + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + ra0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + "\t" + ra0['netmask'] + "\n" if ra0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + ra0['brdaddr'] + "\n") if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += _('Interface:\t/dev/' + wlan0['ifname'] + "\n") self.AboutText += _("IP:") + "\t" + wlan0['addr'] + "\n" if wlan0.has_key('netmask'): self.AboutText += _( "Netmask:") + "\t" + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): self.AboutText += _('Broadcast:\t' + wlan0['brdaddr'] + "\n") if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + "\t" + wlan0['hwaddr'] + "\n" self.iface = 'wlan0' rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) self.AboutText += "\n" + _( "Bytes received:") + "\t" + rx_bytes + ' (~' + str( int(rx_bytes) / 1024 / 1024) + ' MB)' + "\n" self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + ' (~' + str( int(tx_bytes) / 1024 / 1024) + ' MB)' + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += "\n" + _("Hostname:") + "\t" + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.iface = 'wlan0' self.AboutText += iNetwork.getFriendlyAdapterName( self.iface) + ":" + iNetwork.getFriendlyAdapterDescription( self.iface) + "\n" def nameserver(): nameserver = "" v4 = 0 v6 = 0 ns4 = "" ns6 = "" datei = open("/etc/resolv.conf", "r") for line in datei.readlines(): line = line.strip() if "nameserver" in line: if line.count(".") == 3: v4 = v4 + 1 ns4 += str(v4) + ".IPv4 Nameserver" + ":" + line.strip( ).replace("nameserver ", "") + "\n" if line.count(":") > 1 and line.count(":") < 8: v6 = v6 + 1 ns6 += str(v6) + ".IPv6 Nameserver" + ":" + line.strip( ).replace("nameserver ", "") + "\n" nameserver = ns4 + ns6 datei.close() return nameserver.strip() def domain(): domain = "" for line in open('/etc/resolv.conf', 'r'): line = line.strip() if "domain" in line: domain += line.strip().replace("domain ", "") return domain else: domain = _("no domain name found") return domain def gateway(): gateway = "" for line in popen('ip route show'): line = line.strip() if "default via " in line: line = line.split(' ') line = line[2] return line else: line = _("no gateway found") return line def netspeed(): netspeed = "" for line in popen('ethtool eth0 |grep Speed', 'r'): line = line.strip().split(":") line = line[1].replace(' ', '') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed = "" for line in popen('ethtool eth1 |grep Speed', 'r'): line = line.strip().split(":") line = line[1].replace(' ', '') netspeed += line return str(netspeed) if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += _('Interface: /dev/' + eth0['ifname'] + "\n") self.AboutText += _("Network Speed:") + netspeed() + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + eth0['hwaddr'] + "\n" self.AboutText += "\n" + _("IP:") + eth0['addr'] + "\n" self.AboutText += _("Gateway:") + gateway() + "\n" self.AboutText += nameserver() + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): if eth0['brdaddr'] == "0.0.0.0": self.AboutText += _('Broadcast:') + _("DHCP is off") + "\n" else: self.AboutText += _('Broadcast:' + eth0['brdaddr'] + "\n") self.AboutText += _("Domain:") + domain() + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += _('Interface:/dev/' + eth1['ifname'] + "\n") self.AboutText += _("NetSpeed:") + netspeed_eth1() + "\n" if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + eth1['hwaddr'] + "\n" self.AboutText += "\n" + _("IP:") + eth1['addr'] + "\n" self.AboutText += _("Gateway:") + gateway() + "\n" self.AboutText += nameserver() + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + eth1['netmask'] + "\n" if eth1.has_key('brdaddr'): if eth1['brdaddr'] == "0.0.0.0": self.AboutText += _('Broadcast:') + _("DHCP is off") + "\n" else: self.AboutText += _('Broadcast:' + eth1['brdaddr'] + "\n") self.AboutText += _("Domain:") + domain() + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += _('Interface:/dev/') + ra0['ifname'] + "\n" self.AboutText += "\n" + _("IP:") + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + ra0['netmask'] + "\n" if ra0.has_key('brdaddr'): self.AboutText += _("Broadcast:") + ra0['brdaddr'] + "\n" if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += _('Interface:/dev/') + wlan0['ifname'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + wlan0['hwaddr'] + "\n" self.AboutText += "\n" + _("IP:") + wlan0['addr'] + "\n" self.AboutText += _("Gateway:") + gateway() + "\n" self.AboutText += nameserver() + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): if wlan0['brdaddr'] == "0.0.0.0": self.AboutText += _('Broadcast:') + _("DHCP is off") + "\n" else: self.AboutText += _('Broadcast:') + wlan0['brdaddr'] + "\n" self.AboutText += _("Domain:") + domain() + "\n" self.iface = 'wlan0' #not use this , adapter make reset after 4GB (32bit restriction) #rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) #self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + ' (~' + str(int(rx_bytes)/1024/1024) + ' MB)' + "\n" #self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + ' (~' + str(int(tx_bytes)/1024/1024)+ ' MB)' + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += _("Hostname:") + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)
def createscreen(self): self.AboutText = "" self.iface = "eth0" eth0 = about.getIfConfig('eth0') if eth0.has_key('addr'): self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): self.iface = 'wlan0' self.AboutText += iNetwork.getFriendlyAdapterName (self.iface) + ":" + iNetwork.getFriendlyAdapterDescription(self.iface) +"\n" def nameserver(): nameserver = "" v4=0 ; v6=0; ns4 =""; ns6 = "" datei = open("/etc/resolv.conf","r") for line in datei.readlines(): line = line.strip() if "nameserver" in line: if line.count(".") == 3: v4=v4+1 ns4 += str(v4) + ".IPv4 Nameserver" + ":" + line.strip().replace("nameserver ","") + "\n" if line.count(":") > 1 and line.count(":") < 8: v6=v6+1 ns6 += str(v6) + ".IPv6 Nameserver" + ":" + line.strip().replace("nameserver ","") + "\n" nameserver = ns4 + ns6 datei.close() return nameserver.strip() def domain(): domain="" for line in open('/etc/resolv.conf','r'): line = line.strip() if "domain" in line: domain +=line.strip().replace("domain ","") return domain else: domain = _("no domain name found") return domain def gateway(): gateway="" for line in popen('ip route show'): line = line.strip() if "default via " in line: line = line.split(' ') line =line[2] return line else: line = _("no gateway found") return line def netspeed(): netspeed="" for line in popen('ethtool eth0 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) def netspeed_eth1(): netspeed="" for line in popen('ethtool eth1 |grep Speed','r'): line = line.strip().split(":") line =line[1].replace(' ','') netspeed += line return str(netspeed) if eth0.has_key('addr'): if eth0.has_key('ifname'): self.AboutText += _('Interface: /dev/' + eth0['ifname'] + "\n") self.AboutText += _("Network Speed:") + netspeed() + "\n" if eth0.has_key('hwaddr'): self.AboutText += _("MAC:") + eth0['hwaddr'] + "\n" self.AboutText += "\n" + _("IP:") + eth0['addr'] + "\n" self.AboutText += _("Gateway:") + gateway() + "\n" self.AboutText += nameserver() + "\n" if eth0.has_key('netmask'): self.AboutText += _("Netmask:") + eth0['netmask'] + "\n" if eth0.has_key('brdaddr'): if eth0['brdaddr']=="0.0.0.0": self.AboutText += _('Broadcast:') + _("DHCP is off") + "\n" else: self.AboutText += _('Broadcast:' + eth0['brdaddr'] + "\n") self.AboutText += _("Domain:") + domain() + "\n" self.iface = 'eth0' eth1 = about.getIfConfig('eth1') if eth1.has_key('addr'): if eth1.has_key('ifname'): self.AboutText += _('Interface:/dev/' + eth1['ifname'] + "\n") self.AboutText += _("NetSpeed:") + netspeed_eth1() + "\n" if eth1.has_key('hwaddr'): self.AboutText += _("MAC:") + eth1['hwaddr'] + "\n" self.AboutText += "\n" + _("IP:") + eth1['addr'] + "\n" self.AboutText += _("Gateway:") + gateway() + "\n" self.AboutText += nameserver() + "\n" if eth1.has_key('netmask'): self.AboutText += _("Netmask:") + eth1['netmask'] + "\n" if eth1.has_key('brdaddr'): if eth1['brdaddr']=="0.0.0.0": self.AboutText += _('Broadcast:') + _("DHCP is off") + "\n" else: self.AboutText += _('Broadcast:' + eth1['brdaddr'] + "\n") self.AboutText += _("Domain:") + domain() + "\n" self.iface = 'eth1' ra0 = about.getIfConfig('ra0') if ra0.has_key('addr'): if ra0.has_key('ifname'): self.AboutText += _('Interface:/dev/') + ra0['ifname'] + "\n" self.AboutText += "\n" + _("IP:") + ra0['addr'] + "\n" if ra0.has_key('netmask'): self.AboutText += _("Netmask:") + ra0['netmask'] + "\n" if ra0.has_key('brdaddr'): self.AboutText += _("Broadcast:") + ra0['brdaddr'] + "\n" if ra0.has_key('hwaddr'): self.AboutText += _("MAC:") + ra0['hwaddr'] + "\n" self.iface = 'ra0' wlan0 = about.getIfConfig('wlan0') if wlan0.has_key('addr'): if wlan0.has_key('ifname'): self.AboutText += _('Interface:/dev/') + wlan0['ifname'] + "\n" if wlan0.has_key('hwaddr'): self.AboutText += _("MAC:") + wlan0['hwaddr'] + "\n" self.AboutText += "\n" + _("IP:") + wlan0['addr'] + "\n" self.AboutText += _("Gateway:") + gateway() + "\n" self.AboutText += nameserver() + "\n" if wlan0.has_key('netmask'): self.AboutText += _("Netmask:") + wlan0['netmask'] + "\n" if wlan0.has_key('brdaddr'): if wlan0['brdaddr']=="0.0.0.0": self.AboutText += _('Broadcast:') + _("DHCP is off") + "\n" else: self.AboutText += _('Broadcast:') + wlan0['brdaddr'] + "\n" self.AboutText += _("Domain:") + domain() + "\n" self.iface = 'wlan0' #not use this , adapter make reset after 4GB (32bit restriction) #rx_bytes, tx_bytes = about.getIfTransferredData(self.iface) #self.AboutText += "\n" + _("Bytes received:") + "\t" + rx_bytes + ' (~' + str(int(rx_bytes)/1024/1024) + ' MB)' + "\n" #self.AboutText += _("Bytes sent:") + "\t" + tx_bytes + ' (~' + str(int(tx_bytes)/1024/1024)+ ' MB)' + "\n" hostname = file('/proc/sys/kernel/hostname').read() self.AboutText += _("Hostname:") + hostname + "\n" self["AboutScrollLabel"] = ScrollLabel(self.AboutText)