summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordennis@daedalus.ausil.us <>2007-01-26 19:53:02 (GMT)
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2007-01-26 19:53:02 (GMT)
commit51e5cce061cdccc38506eabd898636914aff9ca6 (patch)
treebbcd4007ac5ae3d62e2162e9348068b7fe85a002
parent798ae77fbd0f1930582ba184a66e584913865059 (diff)
downloadsmolt-51e5cce061cdccc38506eabd898636914aff9ca6.zip
smolt-51e5cce061cdccc38506eabd898636914aff9ca6.tar.gz
smolt-51e5cce061cdccc38506eabd898636914aff9ca6.tar.xz
added sparc support and 32 bit ppc
-rw-r--r--hw-client/hardware.py46
1 files changed, 43 insertions, 3 deletions
diff --git a/hw-client/hardware.py b/hw-client/hardware.py
index 5c3a309..820e450 100644
--- a/hw-client/hardware.py
+++ b/hw-client/hardware.py
@@ -387,7 +387,6 @@ def read_cpuinfo():
# class, desc (required to identify the hardware device)
# count, type, model, model_number, model_ver, model_rev
# bogomips, platform, speed, cache
-
hwdict = { 'class': "CPU",
"desc" : "Processor",
}
@@ -502,7 +501,7 @@ def read_cpuinfo():
hwdict['speed'] = -1
hwdict['other'] = get_entry(tmpdict, 'features')
- elif uname in ['ppc64']:
+ elif uname in ['ppc64','ppc']:
tmpdict = {}
count = 0
for cpu in string.split(cpulist, "\n\n"):
@@ -528,14 +527,55 @@ def read_cpuinfo():
hwdict['model_ver'] = get_entry(tmpdict, 'revision')
hwdict['bogomips'] = get_entry(tmpdict, 'bogomips')
hwdict['vendor'] = get_entry(tmpdict, 'machine')
+ hwdict['type'] = get_entry(tmpdict, 'platform')
+ hwdict['system'] = get_entry(tmpdict, 'detected as')
# strings are postpended with "mhz"
mhz_speed = get_entry(tmpdict, 'clock')[:-3]
try:
hwdict['speed'] = int(round(float(mhz_speed)) - 1)
except ValueError:
hwdict['speed'] = -1
+
+ elif uname in ["sparc64","sparc"]:
+ tmpdict = {}
+ bogomips = 0
+ for cpu in string.split(cpulist, "\n\n"):
+ if not len(cpu):
+ continue
+
+ for cpu_attr in string.split(cpu, "\n"):
+ if not len(cpu_attr):
+ continue
+ vals = string.split(cpu_attr, ":")
+ if len(vals) != 2:
+ # XXX: make at least some effort to recover this data...
+ continue
+ name, value = string.strip(vals[0]), string.strip(vals[1])
+ if name.endswith('Bogo'):
+ if bogomips == 0:
+ bogomips = int(round(float(value)) )
+ continue
+ continue
+ tmpdict[string.lower(name)] = string.lower(value)
+ system = ''
+ if not os.access("/proc/openprom/name", os.R_OK):
+ system = 'Unknown'
+ if os.access("/proc/openprom/name", os.R_OK):
+ sys = open("/proc/openprom/name", "r").read()
+ syspart = string.split(sys, ",")
+ system = syspart[1]
+ hwdict['platform'] = uname
+ hwdict['count'] = get_entry(tmpdict, 'ncpus probed')
+ hwdict['model'] = get_entry(tmpdict, 'cpu')
+ hwdict['type'] = get_entry(tmpdict, 'type')
+ hwdict['model_ver'] = get_entry(tmpdict, 'type')
+ hwdict['bogomips'] = bogomips
+ hwdict['vendor'] = 'sun'
+ hwdict['cache'] = "" # pitty the kernel doesn't tell us this.
+ speed = int(round(float(bogomips))) / 2
+ hwdict['speed'] = speed
+ hwdict['system'] = system
-
else:
# XXX: expand me. Be nice to others
hwdict['platform'] = uname