laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/38896?usp=email )


Change subject: pySim.esim.saip: Treat "Readable and Updateable when 
deactivated" flag
......................................................................

pySim.esim.saip: Treat "Readable and Updateable when deactivated" flag

There's a second flag hidden in the TS 102 222 "Special File
Information"; let's parse + re-encode it properly.

Change-Id: I7644d265f746c662b64f7156b3be08a01e3a97aa
Related: OS#6643
---
M pySim/esim/saip/__init__.py
1 file changed, 10 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/96/38896/1

diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 3c46ef8..6707802 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -114,6 +114,7 @@
         self.nb_rec: Optional[int] = None
         self._file_size = 0
         self.high_update: bool = False
+        self.read_and_update_when_deact: bool = False
         self.shareable: bool = True
         self.df_name = None
         self.fill_pattern = None
@@ -194,6 +195,7 @@
         fileDescriptor = {}
         fdb_dec = {}
         pefi = {}
+        spfi = 0
         if self.fid:
             fileDescriptor['fileID'] = self.fid.to_bytes(2, 'big')
         if self.sfi:
@@ -233,7 +235,11 @@
         if len(fd_dict):
             fileDescriptor['fileDescriptor'] = 
build_construct(FileDescriptor._construct, fd_dict)
         if self.high_update:
-            pefi['specialFileInformation'] = b'\x80' # TS 102 222 Table 5
+            spfi |= 0x80 # TS 102 222 Table 5
+        if self.read_and_update_when_deact:
+            spfi |= 0x40 # TS 102 222 Table 5
+        if spfi != 0x00:
+            pefi['specialFileInformation'] = spfi.to_bytes(1)
         if self.fill_pattern:
             if not self.fill_pattern_repeat:
                 pefi['fillPattern'] = self.fill_pattern
@@ -288,8 +294,11 @@
                         self._file_size = 
self._decode_file_size(pefi['maximumFileSize'])
                 specialFileInformation = pefi.get('specialFileInformation', 
None)
                 if specialFileInformation:
+                    # TS 102 222 Table 5
                     if specialFileInformation[0] & 0x80:
                         self.high_update = True
+                    if specialFileInformation[0] & 0x40:
+                        self.read_and_update_when_deact = True
                 if 'repeatPattern' in pefi:
                     self.fill_pattern = pefi['repeatPattern']
                     self.fill_pattern_repeat = True

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38896?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7644d265f746c662b64f7156b3be08a01e3a97aa
Gerrit-Change-Number: 38896
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>

Reply via email to