| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import glob, hashlib, logging, os, pprint, re, sys | 5 import glob, hashlib, logging, os, pprint, re, sys |
| 6 from autotest_lib.client.bin import test, utils | 6 from autotest_lib.client.bin import test, utils |
| 7 from autotest_lib.client.common_lib import error | 7 from autotest_lib.client.common_lib import error |
| 8 from autotest_lib.client.common_lib import flashrom_util | 8 from autotest_lib.client.common_lib import flashrom_util |
| 9 from autotest_lib.client.common_lib import site_vblock | 9 from autotest_lib.client.common_lib import site_vblock |
| 10 | 10 |
| 11 | 11 |
| 12 class hardware_Components(test.test): | 12 class hardware_Components(test.test): |
| 13 version = 1 | 13 version = 1 |
| 14 _cids = [ | 14 _cids = [ |
| 15 'hash_ro_firmware', | 15 'hash_ro_firmware', |
| 16 'part_id_audio_codec', | 16 'part_id_audio_codec', |
| 17 'part_id_cpu', | 17 'part_id_cpu', |
| 18 'part_id_display_panel', | 18 'part_id_display_panel', |
| 19 'part_id_embedded_controller', | 19 'part_id_embedded_controller', |
| 20 'part_id_ethernet', | 20 'part_id_ethernet', |
| 21 'part_id_flash_chip', | 21 'part_id_flash_chip', |
| 22 'part_id_hwqual', | 22 'part_id_hwqual', |
| 23 'part_id_storage', | 23 'part_id_storage', |
| 24 'part_id_wireless', | 24 'part_id_wireless', |
| 25 'vendor_id_bios', | |
| 26 'vendor_id_touchpad', | 25 'vendor_id_touchpad', |
| 27 'version_rw_firmware', | 26 'version_rw_firmware', |
| 28 ] | 27 ] |
| 29 _pci_cids = [ | 28 _pci_cids = [ |
| 30 'part_id_chipset', | 29 'part_id_chipset', |
| 31 'part_id_usb_hosts', | 30 'part_id_usb_hosts', |
| 32 'part_id_vga', | 31 'part_id_vga', |
| 33 ] | 32 ] |
| 34 _usb_cids = [ | 33 _usb_cids = [ |
| 35 'part_id_bluetooth', | 34 'part_id_bluetooth', |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 def get_part_id_wireless(self): | 200 def get_part_id_wireless(self): |
| 202 """ | 201 """ |
| 203 Returns a colon delimited string where the first section | 202 Returns a colon delimited string where the first section |
| 204 is the vendor id and the second section is the device id. | 203 is the vendor id and the second section is the device id. |
| 205 """ | 204 """ |
| 206 part_id = utils.read_one_line('/sys/class/net/wlan0/device/device') | 205 part_id = utils.read_one_line('/sys/class/net/wlan0/device/device') |
| 207 vendor_id = utils.read_one_line('/sys/class/net/wlan0/device/vendor') | 206 vendor_id = utils.read_one_line('/sys/class/net/wlan0/device/vendor') |
| 208 return "%s:%s" % (vendor_id.replace('0x',''), part_id.replace('0x','')) | 207 return "%s:%s" % (vendor_id.replace('0x',''), part_id.replace('0x','')) |
| 209 | 208 |
| 210 | 209 |
| 211 def get_vendor_id_bios(self): | |
| 212 cmd = ('dmidecode | grep -A 1 "BIOS Information" | grep Vendor: ' | |
| 213 '| sed "s/.*Vendor: //"') | |
| 214 part_id = utils.system_output(cmd, ignore_status=True).strip() | |
| 215 return part_id | |
| 216 | |
| 217 | |
| 218 def get_vendor_id_touchpad(self): | 210 def get_vendor_id_touchpad(self): |
| 219 cmd = 'grep -i Touchpad /proc/bus/input/devices | sed s/.\*=//' | 211 cmd = 'grep -i Touchpad /proc/bus/input/devices | sed s/.\*=//' |
| 220 part_id = utils.system_output(cmd).strip('"') | 212 part_id = utils.system_output(cmd).strip('"') |
| 221 return part_id | 213 return part_id |
| 222 | 214 |
| 223 | 215 |
| 224 def get_vendor_id_webcam(self): | 216 def get_vendor_id_webcam(self): |
| 225 cmd = 'cat /sys/class/video4linux/video0/name' | 217 cmd = 'cat /sys/class/video4linux/video0/name' |
| 226 part_id = utils.system_output(cmd).strip() | 218 part_id = utils.system_output(cmd).strip() |
| 227 return part_id | 219 return part_id |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if self._failures: | 333 if self._failures: |
| 342 all_failures += 'Approved DB: %s' % db | 334 all_failures += 'Approved DB: %s' % db |
| 343 all_failures += self.pformat(self._failures) | 335 all_failures += self.pformat(self._failures) |
| 344 else: | 336 else: |
| 345 # If one of DBs is matched, record the hwqual_id and exit. | 337 # If one of DBs is matched, record the hwqual_id and exit. |
| 346 self.write_test_keyval( | 338 self.write_test_keyval( |
| 347 {'hwqual_id': self._approved['part_id_hwqual'][0]}) | 339 {'hwqual_id': self._approved['part_id_hwqual'][0]}) |
| 348 return | 340 return |
| 349 | 341 |
| 350 raise error.TestFail(all_failures) | 342 raise error.TestFail(all_failures) |
| OLD | NEW |