Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tautils.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tautils.py')
-rw-r--r--TurtleArt/tautils.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py
index 76bdf5d..0c6fe64 100644
--- a/TurtleArt/tautils.py
+++ b/TurtleArt/tautils.py
@@ -794,14 +794,17 @@ def find_blk_below(blk, name):
return _gblk
return None
-"""
-Are we on an OLPC XO?
-"""
-
def get_hardware():
""" Determine whether we are using XO 1.0, 1.5, or "unknown" hardware """
- if _get_dmi('product_name') != 'XO':
+ product = _get_dmi('product_name')
+ if product is None:
+ if os.path.exists('/etc/olpc-release') or \
+ os.path.exists('/sys/power/olpc-pm'):
+ return XO1
+ else:
+ return UNKNOWN
+ if product != 'XO':
return UNKNOWN
version = _get_dmi('product_version')
if version == '1':
@@ -813,6 +816,8 @@ def get_hardware():
def _get_dmi(node):
+ ''' The desktop management interface should be a reliable source
+ for product and version information. '''
path = os.path.join('/sys/class/dmi/id', node)
try:
return open(path).readline().strip()