From b36af52f52491df44f2a65f8546791ad9c9f03ac Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Wed, 28 Mar 2007 21:50:25 -0400 Subject: [PATCH] Console: new label with XO Firmware version --- services/console/interface/xo/cpu.py | 17 +++++++------ services/console/interface/xo/system.py | 33 ++++++++++++++++++++----- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/services/console/interface/xo/cpu.py b/services/console/interface/xo/cpu.py index 75209ceb..c0dfbfd2 100644 --- a/services/console/interface/xo/cpu.py +++ b/services/console/interface/xo/cpu.py @@ -23,6 +23,8 @@ import string import gobject import drwarea +import procmem + class CPU_Usage: CPU_HZ = 0 @@ -105,12 +107,12 @@ class XO_CPU(gtk.Frame): self.add(fixed) - DRW_CPU = CPU_Usage() - DRW_CPU.frequency = 1000 # 1 Second + self._DRW_CPU = CPU_Usage() + self._DRW_CPU.frequency = 1000 # 1 Second - gobject.timeout_add(DRW_CPU.frequency, self._update_cpu_usage, DRW_CPU) + gobject.timeout_add(self._DRW_CPU.frequency, self._update_cpu_usage) - def _update_cpu_usage(self, DRW_CPU): + def _update_cpu_usage(self): redraw_all = False @@ -123,7 +125,7 @@ class XO_CPU(gtk.Frame): else: length = len(self._cpu_buffer) - 1 - self._cpu = DRW_CPU._get_CPU_usage() + self._cpu = self._DRW_CPU._get_CPU_usage() self._cpu_buffer.append(self._cpu) self._updated = True @@ -160,10 +162,10 @@ class XO_CPU(gtk.Frame): draw_all = True else: draw_all = False - + context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) context.clip() - + # Drawing horizontal and vertical border lines self.dat.draw_border_lines(context) @@ -251,3 +253,4 @@ class XO_CPU(gtk.Frame): freq+=1 context.stroke() + diff --git a/services/console/interface/xo/system.py b/services/console/interface/xo/system.py index f249d97e..56f1f317 100644 --- a/services/console/interface/xo/system.py +++ b/services/console/interface/xo/system.py @@ -39,6 +39,11 @@ class XO_System(gtk.Fixed): label_build = Label('OLPC Build:', Label.DESCRIPTION) label_build_value = Label(str(build), Label.DESCRIPTION) + # FIRMWARE + firmware = self._get_firmware_version() + label_firmware = Label('XO Firmware:', Label.DESCRIPTION) + label_firmware_value = Label(firmware, Label.DESCRIPTION) + # KERNEL sysinfo = os.uname() label_kernel = Label('Kernel Version:', Label.DESCRIPTION) @@ -47,10 +52,14 @@ class XO_System(gtk.Fixed): # OLPC Build table.attach(label_build, 0, 1, 0, 1) table.attach(label_build_value, 1,2, 0,1) - + + # XO Firmware + table.attach(label_firmware, 0, 1, 1, 2) + table.attach(label_firmware_value, 1, 2, 1, 2) + # Kernel Version - table.attach(label_kernel, 0, 1, 1, 2) - table.attach(label_kernel_value, 1, 2, 1, 2) + table.attach(label_kernel, 0, 1, 2, 3) + table.attach(label_kernel_value, 1, 2, 2, 3) frame = gtk.Frame('System Information') style = Style() @@ -62,13 +71,25 @@ class XO_System(gtk.Fixed): def _get_system_build(self): build_file_path = '/boot/olpc_build' - + try: f = open(build_file_path, 'r') build = int(f.read()) f.close() - + return build except: return "None" - \ No newline at end of file + + # Get XO Firmware Versions + def _get_firmware_version(self): + + try: + # Shell command + cmd = "/usr/sbin/olpc-bios-sig" + + data = os.popen(cmd).readlines() + return data[0].strip() + except: + return "None" +