filesystem: pass total_len to construct of when encoding file contents

In our construct models we frequently use a context parameter "total_len",
we also pass this parameter to construct when we decode files, but we
do not pass it when we generate files. This is a problem, because when
total_len is used in the construct model, this parameter must be known
also when decoding the file.

Let's make sure that the total_len is properly determined and and passed
to construct (via pyosmocom).

Related: OS#5714
Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
This commit is contained in:
Philipp Maier
2024-09-17 18:28:43 +02:00
parent 78c22a7d63
commit efddffe015
9 changed files with 348 additions and 41 deletions

View File

@@ -524,7 +524,7 @@ class RuntimeLchan:
Args:
data : abstract data which is to be encoded and written
"""
data_hex = self.selected_file.encode_hex(data)
data_hex = self.selected_file.encode_hex(data, self.selected_file_size())
return self.update_binary(data_hex)
def read_record(self, rec_nr: int = 0):
@@ -574,7 +574,7 @@ class RuntimeLchan:
rec_nr : Record number to read
data_hex : Abstract data to be written
"""
data_hex = self.selected_file.encode_record_hex(data, rec_nr)
data_hex = self.selected_file.encode_record_hex(data, rec_nr, self.selected_file_record_len())
return self.update_record(rec_nr, data_hex)
def retrieve_data(self, tag: int = 0):