[patch] sim.c waiting char issue

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[patch] sim.c waiting char issue

etienne
This post has NOT been accepted by the mailing list yet.
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
Loading...