Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: client/common_lib/flashrom_util.py

Issue 3367006: Fix semantic bugs in flashrom_util.py (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: change back Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if self.is_verbose: 697 if self.is_verbose:
698 print " - reading current content" 698 print " - reading current content"
699 self.current_image = flashrom.read_whole() 699 self.current_image = flashrom.read_whole()
700 if not self.current_image: 700 if not self.current_image:
701 raise TestError("Cannot read flashrom image. Abort.") 701 raise TestError("Cannot read flashrom image. Abort.")
702 flashrom_size = len(self.current_image) 702 flashrom_size = len(self.current_image)
703 703
704 if not use_fmap_layout: 704 if not use_fmap_layout:
705 layout_image = None 705 layout_image = None
706 elif not layout_image: 706 elif not layout_image:
707 layout_image = current_image 707 layout_image = self.current_image
708 708
709 if layout_desc: 709 if layout_desc:
710 layout = flashrom.detect_layout( 710 layout = flashrom.detect_layout(
711 layout_desc, flashrom_size, layout_image) 711 layout_desc, flashrom_size, layout_image)
712 else: 712 else:
713 layout = flashrom.detect_chromeos_layout( 713 layout = flashrom.detect_chromeos_layout(
714 target, flashrom_size, layout_image) 714 target, flashrom_size, layout_image)
715 self.layout = layout 715 self.layout = layout
716 self.whole_flash_layout = flashrom.detect_layout('all', flashrom_size) 716 self.whole_flash_layout = flashrom.detect_layout('all', flashrom_size,
717 None)
717 if not skip_verify: 718 if not skip_verify:
718 skip_verify = DEFAULT_CHROMEOS_FIRMWARE_SKIP_VERIFY_LIST[target] 719 skip_verify = DEFAULT_CHROMEOS_FIRMWARE_SKIP_VERIFY_LIST[target]
719 self.skip_verify = skip_verify 720 self.skip_verify = skip_verify
720 self.change_history = [] # reset list 721 self.change_history = [] # reset list
721 722
722 def get_current_image(self): 723 def get_current_image(self):
723 """ Returns current flashrom image (physically, not changed) """ 724 """ Returns current flashrom image (physically, not changed) """
724 return self.current_image 725 return self.current_image
725 726
726 def get_latest_changed_image(self): 727 def get_latest_changed_image(self):
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 except ImportError: 917 except ImportError:
917 # print 'using mocks' 918 # print 'using mocks'
918 utils = mock_utils() 919 utils = mock_utils()
919 TestError = mock_TestError 920 TestError = mock_TestError
920 921
921 922
922 # main stub 923 # main stub
923 if __name__ == "__main__": 924 if __name__ == "__main__":
924 # TODO(hungte) provide unit tests or command line usage 925 # TODO(hungte) provide unit tests or command line usage
925 pass 926 pass
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698