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


Change subject: ts_102_221: Better explain 'selected file invalidated'
......................................................................

ts_102_221: Better explain 'selected file invalidated'

Some specs call it 'invalidated', others call it 'deactivaed'.  If the
user is unfamiliar with this, the error message about "invalidated"
might not be obvious enough; let's also mention 'deactivated' in the
message and explicitly mention that it needs to be activated before use.

Change-Id: I91488b0e7dc25a8970022b09e575485a4165eefa
---
M docs/shell.rst
M pySim-shell.py
M pySim/ts_102_221.py
3 files changed, 37 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/65/35565/1

diff --git a/docs/shell.rst b/docs/shell.rst
index 4742b8e..3fa7bf1 100644
--- a/docs/shell.rst
+++ b/docs/shell.rst
@@ -400,7 +400,19 @@

 deactivate_file
 ~~~~~~~~~~~~~~~
-Deactivate the currently selected file.  This used to be called INVALIDATE in 
TS 11.11.
+Deactivate the currently selected file.  A deactivated file can no longer be 
accessed
+for any further operation (such as selecting and subsequently reading or 
writing).
+
+Any access to a file that is deactivated will trigger the error
+*SW 6283 'Selected file invalidated/disabled'*
+
+In order to re-access a deactivated file, you need to activate it again, see 
the
+`activate_file` command below.  Note that for *deactivation* the 
to-be-deactivated
+EF must be selected, but for *activation*, the DF above the to-be-activated
+EF must be selected!
+
+This command sends a DEACTIVATE FILE APDU to
+the card (sed to be called INVALIDATE in TS 11.11 for classic SIM).


 activate_file
diff --git a/pySim-shell.py b/pySim-shell.py
index 6ff484b..c645403 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -882,8 +882,15 @@
     activate_file_parser.add_argument('NAME', type=str, help='File name or FID 
of file to activate')
     @cmd2.with_argparser(activate_file_parser)
     def do_activate_file(self, opts):
-        """Activate the specified EF. This used to be called REHABILITATE in 
TS 11.11 for classic
-        SIM.  You need to specify the name or FID of the file to activate."""
+        """Activate the specified EF by sending an ACTIVATE FILE apdu command 
(used to be called REHABILITATE
+in TS 11.11 for classic SIM).
+
+This command is used to (re-)activate a file that is currently in deactivated 
(sometimes also called
+"invalidated") state.  You need to call this from the DF above the 
to-be-activated EF and specify the name or
+FID of the file to activate.
+
+Note that for *deactivation* the to-be-deactivated EF must be selected, but 
for *activation*, the DF
+above the to-be-activated EF must be selected!"""
         (data, sw) = self._cmd.lchan.activate_file(opts.NAME)

     def complete_activate_file(self, text, line, begidx, endidx) -> List[str]:
diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py
index 308fc4a..65dd87d 100644
--- a/pySim/ts_102_221.py
+++ b/pySim/ts_102_221.py
@@ -808,7 +808,7 @@
                 '6200': 'No information given, state of non-volatile memory 
unchanged',
                 '6281': 'Part of returned data may be corrupted',
                 '6282': 'End of file/record reached before reading Le bytes or 
unsuccessful search',
-                '6283': 'Selected file invalidated',
+                '6283': 'Selected file invalidated/disabled; needs to be 
activated before use',
                 '6284': 'Selected file in termination state',
                 '62f1': 'More data available',
                 '62f2': 'More data available and proactive command pending',

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I91488b0e7dc25a8970022b09e575485a4165eefa
Gerrit-Change-Number: 35565
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-MessageType: newchange

Reply via email to