[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
dexter has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )

Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..

pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

When sending raw APDUs, we access the scc (SimCardCommands) object via
the scc member in the lchan object. Unfortunately self.lchan will not be
populated when the rs (RuntimeState) object is missing. This is in
particular the case when no profile could be detected for the card,
which is a common situation when we boostrap an unprovisioned card.

So let's access the scc object through the card object. This is also
more logical since when we send raw APDUs we work below the level of
logical channels.

Change-Id: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Related: OS#6278
---
M pySim-shell.py
1 file changed, 29 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved




diff --git a/pySim-shell.py b/pySim-shell.py
index 4e08eb7..3d8bd86 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -237,10 +237,15 @@
 @cmd2.with_argparser(apdu_cmd_parser)
 def do_apdu(self, opts):
 """Send a raw APDU to the card, and print SW + Response.
-DANGEROUS: pySim-shell will not know any card state changes, and
-not continue to work as expected if you e.g. select a different
-file."""
-data, sw = self.lchan.scc._tp.send_apdu(opts.APDU)
+CAUTION: this command bypasses the logical channel handling of 
pySim-shell and card state changes are not
+tracked. Dpending on the raw APDU sent, pySim-shell may not continue 
to work as expected if you e.g. select
+a different file."""
+
+# When sending raw APDUs we access the scc object through _scc member 
of the card object. It should also be
+# noted that the apdu command plays an exceptional role since it is 
the only card accessing command that
+# can be executed without the presence of a runtime state (self.rs) 
object. However, this also means that
+# self.lchan is also not present (see method equip).
+data, sw = self.card._scc._tp.send_apdu(opts.APDU)
 if data:
 self.poutput("SW: %s, RESP: %s" % (sw, data))
 else:

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread fixeria
Attention is currently required from: dexter.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )

Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: dexter 
Gerrit-Comment-Date: Wed, 29 Nov 2023 15:16:54 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread laforge
Attention is currently required from: dexter, fixeria.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )

Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..


Patch Set 4: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: fixeria 
Gerrit-Attention: dexter 
Gerrit-Comment-Date: Wed, 29 Nov 2023 14:34:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
Attention is currently required from: fixeria, laforge.

Hello Jenkins Builder, fixeria, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/35161?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder


Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..

pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

When sending raw APDUs, we access the scc (SimCardCommands) object via
the scc member in the lchan object. Unfortunately self.lchan will not be
populated when the rs (RuntimeState) object is missing. This is in
particular the case when no profile could be detected for the card,
which is a common situation when we boostrap an unprovisioned card.

So let's access the scc object through the card object. This is also
more logical since when we send raw APDUs we work below the level of
logical channels.

Change-Id: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Related: OS#6278
---
M pySim-shell.py
1 file changed, 29 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/61/35161/4
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-MessageType: newpatchset


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
Attention is currently required from: fixeria, laforge.

dexter has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )

Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..


Patch Set 3:

(1 comment)

File pySim-shell.py:

https://gerrit.osmocom.org/c/pysim/+/35161/comment/686947c7_1ee83c6b
PS2, Line 244: When sending raw APDUs we access the scc object through _scc 
member of the card object. It should also be
 : # noted that the apdu command plays an exceptional role 
since it is the only card accessing command that
 : # can be executed without the presence of a runt
> Sure, the note is more directed to the programmer so that we do not 
> excellently change it back. […]
Done



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 3
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Wed, 29 Nov 2023 14:03:59 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Comment-In-Reply-To: dexter 
Gerrit-MessageType: comment


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
Attention is currently required from: fixeria, laforge.

dexter has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )

Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..


Patch Set 3:

(1 comment)

File pySim-shell.py:

https://gerrit.osmocom.org/c/pysim/+/35161/comment/1c07e118_8e9ca643
PS2, Line 244: When sending raw APDUs we access the scc object through _scc 
member of the card object. It should also be
 : # noted that the apdu command plays an exceptional role 
since it is the only card accessing command that
 : # can be executed without the presence of a runt
> I think the improtant bit for the user is not how we access the scc object. 
> […]
Sure, the note is more directed to the programmer so that we do not excellently 
change it back. I have now updated the docstring as well.



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 3
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Wed, 29 Nov 2023 14:03:32 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Gerrit-MessageType: comment


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
Attention is currently required from: fixeria, laforge.

Hello Jenkins Builder, fixeria, laforge,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/35161?usp=email

to look at the new patch set (#3).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder


Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..

pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

When sending raw APDUs, we access the scc (SimCardCommands) object via
the scc member in the lchan object. Unfortunately self.lchan will not be
populated when the rs (RuntimeState) object is missing. This is in
particular the case when no profile could be detected for the card,
which is a common situation when we boostrap an unprovisioned card.

So let's access the scc object through the card object. This is also
more logical since when we send raw APDUs we work below the level of
logical channels.

Change-Id: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Related: OS#6278
---
M pySim-shell.py
1 file changed, 29 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/61/35161/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 3
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-MessageType: newpatchset


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread laforge
Attention is currently required from: dexter, fixeria.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )

Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..


Patch Set 2:

(1 comment)

File pySim-shell.py:

https://gerrit.osmocom.org/c/pysim/+/35161/comment/c9711334_3094391a
PS2, Line 244: When sending raw APDUs we access the scc object through _scc 
member of the card object. It should also be
 : # noted that the apdu command plays an exceptional role 
since it is the only card accessing command that
 : # can be executed without the presence of a runt
I think the improtant bit for the user is not how we access the scc object.  
The important bit is that the 'apdu' command bypasses the currentyl selected 
logical channel.  It might be a good idea to ad this to the docstr of the 
do_apdu method, so it ends up in the user manual.



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 2
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Attention: fixeria 
Gerrit-Attention: dexter 
Gerrit-Comment-Date: Wed, 29 Nov 2023 13:08:33 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/35161?usp=email

to look at the new patch set (#2).


Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..

pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

When sending raw APDUs, we access the scc (SimCardCommands) object via
the scc member in the lchan object. Unfortunately self.lchan will not be
populated when the rs (RuntimeState) object is missing. This is in
particular the case when no profile could be detected for the card,
which is a common situation when we boostrap an unprovisioned card.

So let's access the scc object through the card object. This is also
more logical since when we send raw APDUs we work below the level of
logical channels.

Change-Id: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Related: OS#6278
---
M pySim-shell.py
1 file changed, 26 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/61/35161/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 2
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


[S] Change in pysim[master]: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

2023-11-29 Thread dexter
dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/35161?usp=email )


Change subject: pySim-shell: Do not use self.lchan.scc when sending raw APDUs.
..

pySim-shell: Do not use self.lchan.scc when sending raw APDUs.

When sending raw APDUs, we access the scc (SimCardCommands) object via
the scc member in the lchan object. Unfortunately self.lchan will not be
populated when the rs (RuntimeState) object is missing. This is in
particular the case when no profile could be detected for the card,
which is a common situation when we boostrap an unprovisioned card.

So let's access the scc object through the card object. This is also
more logical since when we send raw APDUs we work below the level of
logical channels.

Change-Id: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
---
M pySim-shell.py
1 file changed, 25 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/61/35161/1

diff --git a/pySim-shell.py b/pySim-shell.py
index 4e08eb7..95192ce 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -240,7 +240,12 @@
 DANGEROUS: pySim-shell will not know any card state changes, and
 not continue to work as expected if you e.g. select a different
 file."""
-data, sw = self.lchan.scc._tp.send_apdu(opts.APDU)
+
+# When sending raw APDUs we access the scc object through _scc member 
of the card object. It should also be
+# noted that the apdu command plays an exceptional role since it is 
the only card accessing command that
+# can be executed without the presence of a runtime state (self.rs) 
object. However, this also means that
+# self.lchan is also not present (see method equip).
+data, sw = self.card._scc._tp.send_apdu(opts.APDU)
 if data:
 self.poutput("SW: %s, RESP: %s" % (sw, data))
 else:

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35161?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: I6bbaebe7d7a2013f0ce558ca2da7d58f5e6d991a
Gerrit-Change-Number: 35161
Gerrit-PatchSet: 1
Gerrit-Owner: dexter 
Gerrit-MessageType: newchange