diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-12-23 13:21:56 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-12-23 13:21:56 (GMT) |
commit | 16a3475efeb3f4956620f8eb07136f8e9bf3a67c (patch) | |
tree | 5b13f9d819ac893f1db50d72b65329e7481b0230 /TurtleArt/tautils.py | |
parent | c3b81450372cff7b7bd5649ea4f2cbfe0df70c7f (diff) |
new hw detection code
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r-- | TurtleArt/tautils.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index 3b3b974..0cdc545 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -690,25 +690,25 @@ def find_blk_below(blk, namelist): def get_hardware(): - ''' Determine whether we are using XO 1.0, 1.5, or 'unknown' hardware ''' - product = _get_dmi('product_name') - if product is None: - if os.path.exists('/sys/devices/platform/lis3lv02d/position'): - return XO175 # FIXME: temporary check for XO 1.75 and XO 3.0 - elif os.path.exists('/etc/olpc-release') or \ - os.path.exists('/sys/power/olpc-pm'): - return XO1 - else: - return UNKNOWN - if product != 'XO': - return UNKNOWN + ''' Determine whether we are using XO 1.0, 1.5, ... or 'unknown' + hardware ''' version = _get_dmi('product_version') + # product = _get_dmi('product_name') + if version is None: + hwinfo_path = '/bin/olpc-hwinfo' + if os.path.exists(hwinfo_path) and os.access(hwinfo_path, os.X_OK): + model = check_output([hwinfo_path, 'model'], 'unknown hardware') + version = model.strip() if version == '1': return XO1 elif version == '1.5': - return XO15 - else: + return XO15 + elif version == '1.75': return XO175 + elif version == '4': + return XO175 # XO4 + else: + return UNKNOWN def _get_dmi(node): |