@@ -55,6 +55,8 @@ void io_nfc_init(void)
55
55
LEDGER_PROTOCOL_init (& ledger_protocol_data );
56
56
#ifdef HAVE_NFC_READER
57
57
memset ((void * ) & G_io_reader_ctx , 0 , sizeof (G_io_reader_ctx ));
58
+ G_io_reader_ctx .apdu_rx = rx_apdu_buffer ;
59
+ G_io_reader_ctx .apdu_rx_max_size = sizeof (rx_apdu_buffer );
58
60
#endif // HAVE_NFC_READER
59
61
}
60
62
@@ -69,6 +71,7 @@ void io_nfc_recv_event(void)
69
71
#ifdef HAVE_NFC_READER
70
72
if (G_io_reader_ctx .reader_mode ) {
71
73
G_io_reader_ctx .response_received = true;
74
+ G_io_reader_ctx .apdu_rx_len = ledger_protocol_data .rx_apdu_length ;
72
75
return ;
73
76
}
74
77
#endif // HAVE_NFC_READER
@@ -152,12 +155,8 @@ void io_nfc_process_events(void)
152
155
if (G_io_reader_ctx .resp_callback != NULL ) {
153
156
nfc_resp_callback_t resp_cb = G_io_reader_ctx .resp_callback ;
154
157
G_io_reader_ctx .resp_callback = NULL ;
155
- resp_cb (false,
156
- false,
157
- ledger_protocol_data .rx_apdu_buffer ,
158
- ledger_protocol_data .rx_apdu_length );
158
+ resp_cb (false, false, G_io_reader_ctx .apdu_rx , G_io_reader_ctx .apdu_rx_len );
159
159
}
160
- memset (ledger_protocol_data .rx_apdu_buffer , 0 , ledger_protocol_data .rx_apdu_length );
161
160
}
162
161
163
162
if (G_io_reader_ctx .resp_callback != NULL && G_io_reader_ctx .remaining_ms == 0 ) {
0 commit comments