Open main menu
Home
Random
Log in
Settings
About Sugar Labs
Disclaimers
Sugar Labs
Search
Changes
← Older edit
Newer edit →
Activity Team/FAQ
(view source)
Revision as of 11:11, 9 April 2011
631 bytes added
,
11:11, 9 April 2011
→How do I know if my activity is running on an OLPC XO laptop?
Line 78:
Line 78:
if os.path.exists('/etc/olpc-release'):
if os.path.exists('/etc/olpc-release'):
...
...
+
</pre></li>
+
</ol>
+
+
:Or, check the in /sys/class/dmi/id for the 'product_name' and 'product_version':
+
<ol style="list-style-type:none">
+
<li>
+
<pre>
+
def get_hardware():
+
""" Determine whether we are using XO 1.0, 1.5, or "unknown" hardware """
+
if _get_dmi('product_name') != 'XO':
+
return UNKNOWN
+
version = _get_dmi('product_version')
+
if version == '1':
+
return XO1
+
elif version == '1.5':
+
return XO15
+
else:
+
return UNKNOWN
+
+
+
def _get_dmi(node):
+
path = os.path.join('/sys/class/dmi/id', node)
+
try:
+
return open(path).readline().strip()
+
except:
+
return None
</pre></li>
</pre></li>
</ol>
</ol>
Walter
Bureaucrats
,
Administrators
10,585
edits