steve-m has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/26971 )


Change subject: transport/serial: fix for Python 3
......................................................................

transport/serial: fix for Python 3

Change-Id: I21e5a7ad4f623ed30681dce1ff819679b8714c5b
---
M pySim/transport/serial.py
1 file changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/71/26971/1

diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py
index 4f2b28f..c080926 100644
--- a/pySim/transport/serial.py
+++ b/pySim/transport/serial.py
@@ -184,7 +184,7 @@
        def _send_apdu_raw(self, pdu):

                pdu = h2b(pdu)
-               data_len = ord(pdu[4])  # P3
+               data_len = pdu[4]       # P3

                # Send first CLASS,INS,P1,P2,P3
                self._tx_string(pdu[0:5])
@@ -195,7 +195,7 @@
                #  - SW1: The card can apparently proceed ...
                while True:
                        b = self._rx_byte()
-                       if b == pdu[1]:
+                       if ord(b) == pdu[1]:
                                break
                        elif b != '\x60':
                                # Ok, it 'could' be SW1
@@ -215,7 +215,7 @@
                #  length = [P3 - tx_data (=len(pdu)-len(hdr)) + 2 (SW1//2) ]
                to_recv = data_len - len(pdu) + 5 + 2

-               data = ''
+               data = bytes(0)
                while (len(data) < to_recv):
                        b = self._rx_byte()
                        if (to_recv == 2) and (b == '\x60'): # Ignore NIL if we 
have no RX data (hack ?)

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/26971
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I21e5a7ad4f623ed30681dce1ff819679b8714c5b
Gerrit-Change-Number: 26971
Gerrit-PatchSet: 1
Gerrit-Owner: steve-m <[email protected]>
Gerrit-MessageType: newchange

Reply via email to