summaryrefslogtreecommitdiff
path: root/openpicc/application/iso14443_layer3a.c
diff options
context:
space:
mode:
Diffstat (limited to 'openpicc/application/iso14443_layer3a.c')
-rw-r--r--openpicc/application/iso14443_layer3a.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/openpicc/application/iso14443_layer3a.c b/openpicc/application/iso14443_layer3a.c
index 8dd9cd2..841ad14 100644
--- a/openpicc/application/iso14443_layer3a.c
+++ b/openpicc/application/iso14443_layer3a.c
@@ -130,17 +130,26 @@ void iso14443_layer3a_state_machine (void *pvParameters)
portENTER_CRITICAL();
buffer->state = PROCESSING;
portEXIT_CRITICAL();
+ u_int32_t first_sample = *(u_int32_t*)buffer->data;
DumpStringToUSB("Frame: ");
- DumpUIntToUSB(*(u_int32_t*)buffer->data);
+ DumpUIntToUSB(first_sample);
DumpStringToUSB(" ");
main_help_print_buffer(buffer, &pktcount);
switch(state) {
case IDLE:
case HALT:
- ssc_rx_mode_set(SSC_MODE_14443A_SHORT);
- ssc_rx_start();
+ if(first_sample == WUPA || (state==IDLE && first_sample==REQA)) {
+ /* Need to transmit ATQA */
+ LAYER3_DEBUG("Received ");
+ LAYER3_DEBUG(first_sample == WUPA ? "WUPA" : "REQA");
+ LAYER3_DEBUG(" waking up to send ATQA\n\r");
+ } else {
+ /* Wait for another frame */
+ ssc_rx_mode_set(SSC_MODE_14443A_SHORT);
+ ssc_rx_start();
+ }
break;
default:
break;
personal git repositories of Harald Welte. Your mileage may vary