Vic Yang | ebd6de6 | 2012-06-26 14:25:57 +0800 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | class FAFTClientAttribute(object): |
| 6 | """Class that tests platform name and gives client machine attributes.""" |
| 7 | version = 1 |
| 8 | |
Vic Yang | f78c65f | 2012-07-20 16:32:20 +0800 | [diff] [blame] | 9 | DEFAULT_SETTING = {'keyboard_dev': True, |
| 10 | 'chrome_ec': False, |
| 11 | 'ec_capability': list()} |
Vic Yang | ebd6de6 | 2012-06-26 14:25:57 +0800 | [diff] [blame] | 12 | |
| 13 | def __init__(self, platform): |
| 14 | """Initialized. |
| 15 | |
| 16 | Args: |
| 17 | platform: Platform name returned by FAFT client. |
| 18 | """ |
| 19 | self.__dict__.update(self.DEFAULT_SETTING) |
| 20 | self.__dict__.update(self._get_platform_setting(platform)) |
| 21 | |
| 22 | |
| 23 | def _get_platform_setting(self, platform): |
| 24 | """Return platform-specific settings.""" |
| 25 | setting = dict() |
| 26 | |
| 27 | if platform in ['Aebl', 'Alex', 'Kaen', 'Lumpy', 'Mario', 'Seaboard', |
| 28 | 'Stumpy', 'ZGB']: |
| 29 | setting['keyboard_dev'] = False |
| 30 | |
Vic Yang | f78c65f | 2012-07-20 16:32:20 +0800 | [diff] [blame] | 31 | if platform in ['Link', 'Snow']: |
| 32 | setting['chrome_ec'] = True |
| 33 | |
| 34 | if platform == 'Link': |
| 35 | setting['ec_capability'] = ['adc_ectemp', 'battery', 'charging', |
| 36 | 'keyboard', 'lid', 'x86', 'thermal', |
Vic Yang | 4d72cb6 | 2012-07-24 11:51:09 +0800 | [diff] [blame^] | 37 | 'usb', 'peci'] |
Vic Yang | f78c65f | 2012-07-20 16:32:20 +0800 | [diff] [blame] | 38 | elif platform == 'Snow': |
| 39 | setting['ec_capability'] = ['battery', 'charging', 'keyboard', |
| 40 | 'lid', 'arm'] |
| 41 | |
Vic Yang | ebd6de6 | 2012-06-26 14:25:57 +0800 | [diff] [blame] | 42 | return setting |