Skip to content

Commit

Permalink
Comment out debugging from development
Browse files Browse the repository at this point in the history
  • Loading branch information
bettse committed Jul 24, 2024
1 parent 86b2520 commit 188f592
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions t_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ uint8_t cPCB = 0x00; // Init to 0x40 so first call to next_pcb will return 0x00

uint8_t seader_next_dpcb() {
uint8_t next_pcb = dPCB ^ 0x40;
FURI_LOG_D(TAG, "dPCB was: %02X, current dPCB: %02X", dPCB, next_pcb);
//FURI_LOG_D(TAG, "dPCB was: %02X, current dPCB: %02X", dPCB, next_pcb);
dPCB = next_pcb;
return dPCB;
}

uint8_t seader_next_cpcb() {
uint8_t next_pcb = cPCB ^ 0x40;
FURI_LOG_D(TAG, "cPCB was: %02X, current cPCB: %02X", cPCB, next_pcb);
//FURI_LOG_D(TAG, "cPCB was: %02X, current cPCB: %02X", cPCB, next_pcb);
cPCB = next_pcb;
return cPCB;
}
Expand Down Expand Up @@ -61,7 +61,7 @@ void seader_t_1_send_ack(Seader* seader) {

frame_len = seader_add_lrc(frame, frame_len);

FURI_LOG_D(TAG, "Sending R-Block ACK: PCB: %02x", frame[1]);
//FURI_LOG_D(TAG, "Sending R-Block ACK: PCB: %02x", frame[1]);

seader_ccid_XfrBlock(seader_uart, frame, frame_len);
}
Expand Down Expand Up @@ -99,12 +99,14 @@ void seader_send_t1(SeaderUartBridge* seader_uart, uint8_t* apdu, size_t len) {

frame_len = seader_add_lrc(frame, frame_len);

/*
FURI_LOG_D(
TAG,
"Sending T=1 frame %s more bit set. Remaining: %d, Copy Length: %d",
(remaining > IFSC_VALUE) ? "with" : "without",
remaining,
copy_length);
*/

seader_ccid_XfrBlock(seader_uart, frame, frame_len);

Expand Down Expand Up @@ -140,11 +142,11 @@ bool seader_recv_t1(Seader* seader, CCID_Message* message) {
FURI_LOG_W(TAG, "Invalid T=1 frame: too short");
return false;
}
uint8_t NAD = message->payload[0];
//uint8_t NAD = message->payload[0];
uint8_t rPCB = message->payload[1];
uint8_t LEN = message->payload[2];
uint8_t LRC = message->payload[3 + LEN];
FURI_LOG_D(TAG, "NAD: %02X, rPCB: %02X, LEN: %02X, LRC: %02X", NAD, rPCB, LEN, LRC);
//uint8_t LRC = message->payload[3 + LEN];
//FURI_LOG_D(TAG, "NAD: %02X, rPCB: %02X, LEN: %02X, LRC: %02X", NAD, rPCB, LEN, LRC);

if(rPCB == 0xE1) {
// S(IFS response)
Expand Down Expand Up @@ -182,12 +184,12 @@ bool seader_recv_t1(Seader* seader, CCID_Message* message) {
message->dwLength = LEN;

if(message->dwLength == 0) {
FURI_LOG_D(TAG, "Received T=1 frame with no data");
//FURI_LOG_D(TAG, "Received T=1 frame with no data");
return true;
}
return seader_worker_process_sam_message(seader, message->payload, message->dwLength);
} else if(rPCB == (cPCB | MORE_BIT)) {
FURI_LOG_D(TAG, "Received T=1 frame with more bit set");
//FURI_LOG_D(TAG, "Received T=1 frame with more bit set");
if(seader_t_1_rx_buffer == NULL) {
seader_t_1_rx_buffer = bit_buffer_alloc(512);
}
Expand All @@ -198,12 +200,15 @@ bool seader_recv_t1(Seader* seader, CCID_Message* message) {
uint8_t R_SEQ = (rPCB & R_SEQUENCE_NUMBER_MASK) >> 4;
uint8_t I_SEQ = (dPCB ^ 0x40) >> 6;
if(R_SEQ != I_SEQ) {
/*
FURI_LOG_D(
TAG,
"Received R-Block: Incorrect sequence. Expected: %02X, Received: %02X",
I_SEQ,
R_SEQ);
*/
// When this happens, the flipper freezes if it is doing NFC and my attempts to do events to stop that have failed
return false;
}

Expand Down

0 comments on commit 188f592

Please sign in to comment.