From e17e277a2416221ad899243dd014babca5981b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ams=C3=BCss?= Date: Tue, 19 Apr 2022 10:29:09 +0200 Subject: [PATCH] ts_102_222: Set number of records when creating linear files This information is mandatory for linear files as per TS 102 221 V15 section 11.1.1.4.3. This might not have been spotted earlier because cards of type sysmoISIM-SJA2 accept creation without it as well. Change-Id: I8aeb869c601ee5d1c8b02da6d72eb3c50e347982 --- pySim/ts_102_222.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pySim/ts_102_222.py b/pySim/ts_102_222.py index 2c1d600e..c7cff85c 100644 --- a/pySim/ts_102_222.py +++ b/pySim/ts_102_222.py @@ -139,6 +139,9 @@ class Ts102222Commands(CommandSet): self._cmd.perror("you must specify the --record-length for linear fixed EF") return file_descriptor['record_len'] = opts.record_length + file_descriptor['num_of_rec'] = opts.file_size // opts.record_length + if file_descriptor['num_of_rec'] * file_descriptor['record_len'] != opts.file_size: + raise ValueError("File size not evenly divisible by record length") elif opts.structure == 'ber_tlv': self._cmd.perror("BER-TLV creation not yet fully supported, sorry") return