From 16a3475efeb3f4956620f8eb07136f8e9bf3a67c Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sun, 23 Dec 2012 13:21:56 +0000 Subject: new hw detection code --- (limited to 'TurtleArt') 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): -- cgit v0.9.1