mirror of
https://gitea.osmocom.org/sim-card/pysim.git
synced 2026-03-18 19:38:34 +03:00
commands: conserve write cycles
When a record or a binary file is written the card goes throth a full flash/eeprom write cycle at this location, even when the data does not change. This can be optimized by reading before writing in order to compere if the data we are about to write is actually different. Change-Id: Ifd1b80d3ede15a7caa29077a37ac7cf58c9053f1 Related: OS#4963
This commit is contained in:
committed by
Harald Welte
parent
2b11c32e20
commit
38c74f6d41
@@ -67,11 +67,17 @@ class PysimApp(cmd2.Cmd):
|
||||
self.numeric_path = False
|
||||
self.add_settable(cmd2.Settable('numeric_path', bool, 'Print File IDs instead of names',
|
||||
onchange_cb=self._onchange_numeric_path))
|
||||
self.conserve_write = True
|
||||
self.add_settable(cmd2.Settable('conserve_write', bool, 'Read and compare before write',
|
||||
onchange_cb=self._onchange_conserve_write))
|
||||
self.update_prompt()
|
||||
|
||||
def _onchange_numeric_path(self, param_name, old, new):
|
||||
self.update_prompt()
|
||||
|
||||
def _onchange_conserve_write(self, param_name, old, new):
|
||||
self.rs.conserve_write = new
|
||||
|
||||
def update_prompt(self):
|
||||
path_list = self.rs.selected_file.fully_qualified_path(not self.numeric_path)
|
||||
self.prompt = 'pySIM-shell (%s)> ' % ('/'.join(path_list))
|
||||
|
||||
Reference in New Issue
Block a user