sim.c waiting char issue

Submitted by etienne on July 28, 2015, 4:36 p.m.

Details

Message ID 1438101369892-4026719.post@n3.nabble.com
State New
Headers show

Commit Message

etienne July 28, 2015, 4:36 p.m.
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.


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.

Patch hide | download patch | download mbox

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");