| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 This module provides convenience routines to access Flash ROM (EEPROM). | 7 This module provides convenience routines to access Flash ROM (EEPROM). |
| 8 - flashrom_util is a low level wrapper of flashrom(8) program. | 8 - flashrom_util is a low level wrapper of flashrom(8) program. |
| 9 - FlashromUtility is a high level object which provides more advanced | 9 - FlashromUtility is a high level object which provides more advanced |
| 10 features like journaling-alike (log-based) changing. | 10 features like journaling-alike (log-based) changing. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 """ | 245 """ |
| 246 (Utility) Uses fmap_decode to retrieve embedded layout of a prepared | 246 (Utility) Uses fmap_decode to retrieve embedded layout of a prepared |
| 247 firmware image. | 247 firmware image. |
| 248 Args: | 248 Args: |
| 249 conversion_map: dictionary for FMAP area name conversion | 249 conversion_map: dictionary for FMAP area name conversion |
| 250 image_blob: binary data of firmware image containing FMAP | 250 image_blob: binary data of firmware image containing FMAP |
| 251 | 251 |
| 252 Returns: layout structure for flashrom_util, or empty for failure. | 252 Returns: layout structure for flashrom_util, or empty for failure. |
| 253 """ | 253 """ |
| 254 try: | 254 try: |
| 255 import site_fmap | 255 import fmap |
| 256 fmap_object = site_fmap.fmap_decode(image_blob)['areas'] | 256 fmap_object = fmap.fmap_decode(image_blob)['areas'] |
| 257 except: | 257 except: |
| 258 # print 'decode_fmap_layout: failed to decode from image blob' | 258 # print 'decode_fmap_layout: failed to decode from image blob' |
| 259 fmap_object = [] | 259 fmap_object = [] |
| 260 return _convert_fmap_layout(conversion_map, fmap_object) | 260 return _convert_fmap_layout(conversion_map, fmap_object) |
| 261 | 261 |
| 262 | 262 |
| 263 def csv_to_list(csv, delimiter=','): | 263 def csv_to_list(csv, delimiter=','): |
| 264 """ | 264 """ |
| 265 (Utility) Converts a comma-separated-value (or list) to a list. | 265 (Utility) Converts a comma-separated-value (or list) to a list. |
| 266 | 266 |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 except ImportError: | 1048 except ImportError: |
| 1049 # print 'using mocks' | 1049 # print 'using mocks' |
| 1050 utils = mock_utils() | 1050 utils = mock_utils() |
| 1051 TestError = mock_TestError | 1051 TestError = mock_TestError |
| 1052 | 1052 |
| 1053 | 1053 |
| 1054 # main stub | 1054 # main stub |
| 1055 if __name__ == "__main__": | 1055 if __name__ == "__main__": |
| 1056 # TODO(hungte) provide unit tests or command line usage | 1056 # TODO(hungte) provide unit tests or command line usage |
| 1057 pass | 1057 pass |
| OLD | NEW |