Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On 10/01/2011 01:32 PM, Sascha Silbe wrote: Excerpts from Paul Fox's message of 2011-09-29 14:38:35 +0200: yes, it would be much better to centralize this -- we'll certainly be going through this again in the future. please use olpc-hwinfo from sugar, if possible. Since we're talking about a few lines of code only, I'd prefer the code duplication over having to depend on a vendor package. Especially since device tree is cross-platform (in the hardware sense), so the same code would work on more than just XOs. Sascha Thanks for all the comments! After another discussion with Daniel I made the patch hardware independent [1]. As the firmware version we display the bios version if available on non XO hardware. As ethtool has become a depedency of Sugar we can now display the wireless firmware as well on all hardwares. The serial number is often only readable by root on non-XO hardware. If the serial number can not be found on an XO we hide that part of the section. For the future I think we can enhance the section. For example I think it makes sense to display the wireless driver (e.g. iwl3945) as well when displaying the wireless firmware version. As well it would be nice to display the model in the identity section. This can be done hardware independent as well with the usage of /sys/class/dmi/id/product_version and /sys/class/dmi/id/product_name (see [2]). Regards, Simon [1] http://lists.sugarlabs.org/archive/sugar-devel/2011-October/033714.html [2] http://dev.laptop.org/attachment/ticket/11232/11232-fix.png ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
Excerpts from Paul Fox's message of 2011-09-29 14:38:35 +0200: yes, it would be much better to centralize this -- we'll certainly be going through this again in the future. please use olpc-hwinfo from sugar, if possible. Since we're talking about a few lines of code only, I'd prefer the code duplication over having to depend on a vendor package. Especially since device tree is cross-platform (in the hardware sense), so the same code would work on more than just XOs. Sascha -- http://sascha.silbe.org/ http://www.infra-silbe.de/ signature.asc Description: PGP signature ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On 09/29/2011 03:46 AM, James Cameron wrote: On Wed, Sep 28, 2011 at 04:24:06PM +0200, Simon Schampijer wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Nak. compatible is the more correct property in device-tree to use for identifying XO-1.75, and is the property that OpenFirmware plans to ensure is correct. So on 1.75 /proc/device-tree/compatible instead of /proc/device-tree/banner-name, right? olpc-utils [1] should be updated then accordingly as well, I presume? Would be great to use the same checks in both places, your patch seem to differ in a few more places. Regards, Simon [1] http://dev.laptop.org/git/projects/olpc-utils/tree/usr/share/olpc-utils/olpc-utils-functions?id=b1cb93b6d704981b50d721486c132aa62a4776ff [2] http://dev.laptop.org/attachment/ticket/11232/11232-fix.patch ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On Thu, Sep 29, 2011 at 09:34:55AM +0200, Simon Schampijer wrote: On 09/29/2011 03:46 AM, James Cameron wrote: On Wed, Sep 28, 2011 at 04:24:06PM +0200, Simon Schampijer wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Nak. compatible is the more correct property in device-tree to use for identifying XO-1.75, and is the property that OpenFirmware plans to ensure is correct. So on 1.75 /proc/device-tree/compatible instead of /proc/device-tree/banner-name, right? That was my understanding. Discussion I had was with Paul Fox on 16th August, and had to do with keymap rules and the need to not parse the text, but rather support equivalence checking. It was first available in Q4B08. olpc-utils [1] should be updated then accordingly as well, I presume? I don't know. b1cb93b6d seems to predate the discussion I had. If it isn't changing, then you may as well duplicate it and have two copies to maintain. Would be great to use the same checks in both places, your patch seem to differ in a few more places. I think it would be better to have checks in one place, and there's an olpc-hwinfo script available that could be used instead now. Could you use that? Much less Sugar code then. -- James Cameron http://quozl.linux.org.au/ ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
james wrote: On Thu, Sep 29, 2011 at 09:34:55AM +0200, Simon Schampijer wrote: On 09/29/2011 03:46 AM, James Cameron wrote: On Wed, Sep 28, 2011 at 04:24:06PM +0200, Simon Schampijer wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Nak. compatible is the more correct property in device-tree to use for identifying XO-1.75, and is the property that OpenFirmware plans to ensure is correct. So on 1.75 /proc/device-tree/compatible instead of /proc/device-tree/banner-name, right? That was my understanding. Discussion I had was with Paul Fox on 16th August, and had to do with keymap rules and the need to not parse the text, but rather support equivalence checking. It was first available in Q4B08. olpc-utils [1] should be updated then accordingly as well, I presume? I don't know.b1cb93b6d seems to predate the discussion I had. If it isn't changing, then you may as well duplicate it and have two copies to maintain. Would be great to use the same checks in both places, your patch seem to differ in a few more places. I think it would be better to have checks in one place, and there's an olpc-hwinfo script available that could be used instead now. Could you use that? Much less Sugar code then. yes, it would be much better to centralize this -- we'll certainly be going through this again in the future. please use olpc-hwinfo from sugar, if possible. (i'm surprised /proc/device-tree/compatible isn't being used in olpc-utils. presumably it wasn't available yet.) paul =- paul fox, p...@laptop.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On Wed, Sep 28, 2011 at 10:24 AM, Simon Schampijer si...@schampijer.de wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Can we finally agree to create a toolkit method for this? As an activity maintainer who needs to occasionally do things differently on an XO than other HW, it would be really nice to not have to keep changing my XO detection methods as the system changes under me. regards. -walter Follow up patch of b454c1253d95fc62c0cdf9ce34c40397a3c6f49e Signed-off-by: Simon Schampijer si...@laptop.org --- extensions/cpsection/aboutcomputer/model.py | 46 +++ extensions/cpsection/aboutcomputer/view.py | 4 +- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/extensions/cpsection/aboutcomputer/model.py b/extensions/cpsection/aboutcomputer/model.py index a02eee6..8cf3abb 100644 --- a/extensions/cpsection/aboutcomputer/model.py +++ b/extensions/cpsection/aboutcomputer/model.py @@ -41,6 +41,52 @@ _MODEL = 'openprom/model' _logger = logging.getLogger('ControlPanel - AboutComputer') _not_available = _('Not available') +XO_1 = '1' +XO_1_5 = '1.5' +XO_1_75 = '1.75' + + +def _get_xo_version(): + Gets the version of the XO + + There has been three revisions of the XO hardware as + of today: 1, 1.5, 1.75 + + Returns: a string indicating the version of the XO or None if + the hardware is not an XO + + + xo_version = None + if os.path.exists('/proc/device-tree/banner-name'): + content = _read_file('/proc/device-tree/banner-name') + if re.match(r'OLPC\ [BC][0-9]', content): + xo_version = XO_1 + elif re.match(r'OLPC\ D[0-9]', content): + xo_version = XO_1_5 + elif re.match(r'OLPC\ 1[ABC][0-9]', content): + xo_version = XO_1_75 + elif os.path.exists('/sys/class/dmi/id/product_name'): + if _read_file('/sys/class/dmi/id/product_name') == 'XO' and \ + os.path.exists('/sys/class/dmi/id/product_version'): + content = _read_file('/sys/class/dmi/id/product_version') + if content == '1': + xo_version = XO_1 + elif content == '1.5': + xo_version = XO_1_5 + elif os.path.exists('/ofw/banner-name'): + content = _read_file('/ofw/banner-name') + if re.match(r'OLPC\ [BC][0-9]', content): + xo_version = XO_1 + return xo_version + + +def is_xo(): + Checks if the underlying hardware is an XO + + Returns: True in the case the underlying hardware is an XO + + return _get_xo_version() is not None + def get_aboutcomputer(): msg = 'Serial Number: %s \nBuild Number: %s \nFirmware Number: %s \n' \ diff --git a/extensions/cpsection/aboutcomputer/view.py b/extensions/cpsection/aboutcomputer/view.py index e5f2f32..baddbe2 100644 --- a/extensions/cpsection/aboutcomputer/view.py +++ b/extensions/cpsection/aboutcomputer/view.py @@ -47,7 +47,7 @@ class AboutComputer(SectionView): scrollwindow.add_with_viewport(self._vbox) self._vbox.show() - if os.path.exists('/ofw'): + if self._model.is_xo(): self._setup_identity() self._setup_software() @@ -127,7 +127,7 @@ class AboutComputer(SectionView): box_software.pack_start(box_sugar, expand=False) box_sugar.show() - if os.path.exists('/ofw'): + if self._model.is_xo(): box_firmware = gtk.HBox(spacing=style.DEFAULT_SPACING) label_firmware = gtk.Label(_('Firmware:')) label_firmware.set_alignment(1, 0) -- 1.7.4.4 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On 09/28/2011 06:24 PM, Walter Bender wrote: On Wed, Sep 28, 2011 at 10:24 AM, Simon Schampijersi...@schampijer.de wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Can we finally agree to create a toolkit method for this? As an activity maintainer who needs to occasionally do things differently on an XO than other HW, it would be really nice to not have to keep changing my XO detection methods as the system changes under me. regards. -walter We discussed this a bit briefly the other day with Gonzalo and Daniel. The pro is, that code is not duplicated in activities. The con is, that activities should not depend on any hardware and use other methods to determine specific hardware (camera detection etc) and maybe there should be guidelines about good practices. Good topic, we should see what makes sense and what we can agree on. Regards, Simon ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On Wed, Sep 28, 2011 at 12:30 PM, Simon Schampijer si...@schampijer.de wrote: On 09/28/2011 06:24 PM, Walter Bender wrote: On Wed, Sep 28, 2011 at 10:24 AM, Simon Schampijersi...@schampijer.de wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Can we finally agree to create a toolkit method for this? As an activity maintainer who needs to occasionally do things differently on an XO than other HW, it would be really nice to not have to keep changing my XO detection methods as the system changes under me. regards. -walter We discussed this a bit briefly the other day with Gonzalo and Daniel. The pro is, that code is not duplicated in activities. The con is, that activities should not depend on any hardware and use other methods to determine specific hardware (camera detection etc) and maybe there should be guidelines about good practices. I am sure that most of my problems are related to poor programming practice, but in every activity I write, I need to set a font scale differently for the XO than other HW and when I do have, for example, the proper alsa controls for the microphone-sensor input, I still need to know which version of the XO hardware I am using to set proper calibration levels... So I don't see a work-around to not depending on hardware. Some code snippets to show me the way would be greatly appreciated (please add links from the Activity Team pages and in the Almanac). regards -walter Good topic, we should see what makes sense and what we can agree on. Regards, Simon -- Walter Bender Sugar Labs http://www.sugarlabs.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] [PATCH sugar] Control Panel About my Computer: show information on XO 1.75 OLPC #11232
On Wed, Sep 28, 2011 at 04:24:06PM +0200, Simon Schampijer wrote: '/ofw' has been removed on the XOs now. We need to refine the check if the machine is an XO in order to display the information accordingly. Nak. compatible is the more correct property in device-tree to use for identifying XO-1.75, and is the property that OpenFirmware plans to ensure is correct. -- James Cameron http://quozl.linux.org.au/ ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel