Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-08-18 11:10:19 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-08-18 12:40:02 (GMT)
commitb454c1253d95fc62c0cdf9ce34c40397a3c6f49e (patch)
tree8e6ec1cdc9c3d0dbab03fd5acf8b7c16a1f47614 /src
parentef01c0d8e582eae0cd1c1550a9585138b0a6b457 (diff)
Add support for XO 1.75
The hardware specific information has been moved from '/ofw' to '/proc/device-tree'. This has an effect on the Control Panel where we display the serial number and the firmware number. Furthermore the registration code needs to be aware of the possible new place in order to send the serial number and UUID during authentication. Signed-off-by: Simon Schampijer <simon@laptop.org> Reviewed-by: Gonzalo Odiard <gonzalo@laptop.org> Tested-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/desktop/schoolserver.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py
index 634817b..a4a401a 100644
--- a/src/jarabe/desktop/schoolserver.py
+++ b/src/jarabe/desktop/schoolserver.py
@@ -33,6 +33,10 @@ from sugar.profile import get_profile
_REGISTER_URL = 'http://schoolserver:8080/'
_REGISTER_TIMEOUT = 8
+_OFW_TREE = '/ofw'
+_PROC_TREE = '/proc/device-tree'
+_MFG_SN = 'mfg-data/SN'
+_MFG_UUID = 'mfg-data/U#'
def _generate_serial_number():
@@ -107,13 +111,16 @@ def register_laptop(url=_REGISTER_URL):
client = gconf.client_get_default()
if _have_ofw_tree():
- sn = _read_ofw('mfg-data/SN')
- uuid_ = _read_ofw('mfg-data/U#')
- sn = sn or 'SHF00000000'
- uuid_ = uuid_ or '00000000-0000-0000-0000-000000000000'
+ sn = _read_mfg_data(os.path.join(_OFW_TREE, _MFG_SN))
+ uuid_ = _read_mfg_data(os.path.join(_PROC_TREE, _MFG_UUID))
+ elif _have_proc_device_tree():
+ sn = _read_mfg_data(os.path.join(_PROC_TREE, _MFG_SN))
+ uuid_ = _read_mfg_data(os.path.join(_PROC_TREE, _MFG_UUID))
else:
sn = _generate_serial_number()
uuid_ = str(uuid.uuid1())
+ sn = sn or 'SHF00000000'
+ uuid_ = uuid_ or '00000000-0000-0000-0000-000000000000'
setting_name = '/desktop/sugar/collaboration/jabber_server'
jabber_server = client.get_string(setting_name)
@@ -150,11 +157,14 @@ def register_laptop(url=_REGISTER_URL):
def _have_ofw_tree():
- return os.path.exists('/ofw')
+ return os.path.exists(_OFW_TREE)
-def _read_ofw(path):
- path = os.path.join('/ofw', path)
+def _have_proc_device_tree():
+ return os.path.exists(_PROC_TREE)
+
+
+def _read_mfg_data(path):
if not os.path.exists(path):
return None
fh = open(path, 'r')