mirror of
https://gitea.osmocom.org/sim-card/simtrace2.git
synced 2026-03-24 17:28:32 +03:00
card_emu: Initialize PTSS state every time we start PTS
Let's shift the responsibility from the caller side to the calee side. Change-Id: I39661ca93c87b2e2071765f69578eec5aaf90ce4
This commit is contained in:
@@ -240,7 +240,6 @@ static void card_handle_reset(struct card_handle *ch)
|
|||||||
|
|
||||||
tc_etu_disable(ch->tc_chan);
|
tc_etu_disable(ch->tc_chan);
|
||||||
|
|
||||||
ch->pts.state = PTS_S_WAIT_REQ_PTSS;
|
|
||||||
ch->tpdu.state = TPDU_S_WAIT_CLA;
|
ch->tpdu.state = TPDU_S_WAIT_CLA;
|
||||||
|
|
||||||
/* release any buffers we may still own */
|
/* release any buffers we may still own */
|
||||||
@@ -534,8 +533,6 @@ static int tx_byte_atr(struct card_handle *ch)
|
|||||||
/* update waiting time (see ISO 7816-3 10.2) */
|
/* update waiting time (see ISO 7816-3 10.2) */
|
||||||
ch->waiting_time = ch->wi * 960 * ch->fi;
|
ch->waiting_time = ch->wi * 960 * ch->fi;
|
||||||
tc_etu_set_wtime(ch->tc_chan, ch->waiting_time);
|
tc_etu_set_wtime(ch->tc_chan, ch->waiting_time);
|
||||||
/* reset PTS to initial state */
|
|
||||||
set_pts_state(ch, PTS_S_WAIT_REQ_PTSS);
|
|
||||||
/* go to next state */
|
/* go to next state */
|
||||||
card_set_state(ch, ISO_S_WAIT_TPDU);
|
card_set_state(ch, ISO_S_WAIT_TPDU);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -701,7 +698,6 @@ static int tx_byte_pts(struct card_handle *ch)
|
|||||||
emu_update_fidi(ch);
|
emu_update_fidi(ch);
|
||||||
/* Wait for the next TPDU */
|
/* Wait for the next TPDU */
|
||||||
card_set_state(ch, ISO_S_WAIT_TPDU);
|
card_set_state(ch, ISO_S_WAIT_TPDU);
|
||||||
set_pts_state(ch, PTS_S_WAIT_REQ_PTSS);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* calculate the next state and set it */
|
/* calculate the next state and set it */
|
||||||
@@ -979,6 +975,8 @@ void card_emu_process_rx_byte(struct card_handle *ch, uint8_t byte)
|
|||||||
switch (ch->state) {
|
switch (ch->state) {
|
||||||
case ISO_S_WAIT_TPDU:
|
case ISO_S_WAIT_TPDU:
|
||||||
if (byte == 0xff) {
|
if (byte == 0xff) {
|
||||||
|
/* reset PTS to initial state */
|
||||||
|
set_pts_state(ch, PTS_S_WAIT_REQ_PTSS);
|
||||||
new_state = process_byte_pts(ch, byte);
|
new_state = process_byte_pts(ch, byte);
|
||||||
ch->stats.pps++;
|
ch->stats.pps++;
|
||||||
goto out_silent;
|
goto out_silent;
|
||||||
|
|||||||
Reference in New Issue
Block a user