[patch] sim.c waiting char issue

etienne etiennehelluy at gmail.com
Tue Jul 28 16:36:09 UTC 2015


Hello, 
The sim driver was not working with my sim card. 
After some successful apdu requests, it was ceasing to work.
It turned out that the sim is sending waiting chars before some rx acks.
The following patch solved the problem.

diff --git a/src/target/firmware/calypso/sim.c
b/src/target/firmware/calypso/sim.c
index 752628f..b35909f 100644
--- a/src/target/firmware/calypso/sim.c
+++ b/src/target/firmware/calypso/sim.c
@@ -536,6 +536,8 @@ void sim_handler(void)
                /* Case 2: No input / Output of known length */
                if (mode == SIM_APDU_PUT) {
                        sim_state = SIM_STATE_RX_ACK;
+                       /* ignore waiting char here*/
+                       sim_ignore_waiting_char = 1;
                        calypso_sim_receive(response, 1);
                        break;
                /* Case 4: Input / No output */
@@ -563,6 +565,8 @@ void sim_handler(void)
                        break; /* wait until data is received */
                /* Disable all interrupt driven functions */
                writew(0xFF, REG_SIM_MASKIT);
+               /*stop ignoring waiting char*/
+               sim_ignore_waiting_char = 0;
                /* error received */
                if (sim_rx_character_count == 2) {
                        puts("SIM: command failed\n");

Regards,
Etienne




--
View this message in context: http://baseband-devel.722152.n3.nabble.com/patch-sim-c-waiting-char-issue-tp4026719.html
Sent from the baseband-devel mailing list archive at Nabble.com.



More information about the baseband-devel mailing list