laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30200 )
Change subject: firmware/sniffer: Enable interrupts for overrun/parity/frame errors
......................................................................
firmware/sniffer: Enable interrupts for overrun/parity/frame errors
We so far didn't have interrupts enabled for those, and just caught
them "by accident" if a byte was received or if a timeout happened.
Let's explicitly enable those interrupts so we also catch those
conditions by themselves.
Change-Id: Ia27f537706b9a6252dd18175545c6f27a7d17d0e
---
M firmware/libcommon/source/sniffer.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index 35de58f..948eee8 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -918,7 +918,7 @@
* Initialization routine
*-----------------------------------------------------------------------------*/
-#define SNIFFER_IER (US_IER_RXRDY | US_IER_TIMEOUT)
+#define SNIFFER_IER (US_IER_RXRDY | US_IER_TIMEOUT | US_IER_OVRE | US_IER_FRAME | US_IER_PARE)
/* Called during USB enumeration after device is enumerated by host */
void Sniffer_configure(void)
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30200
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ia27f537706b9a6252dd18175545c6f27a7d17d0e
Gerrit-Change-Number: 30200
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30198 )
Change subject: firmware/sniffer: Handle WT timeouts via ring-buffer
......................................................................
firmware/sniffer: Handle WT timeouts via ring-buffer
Before this patch, all UART characters went through a fifo/ringbuffer
of depth 512, while events like timeout were delivered directly via
a global flags variable from ISR to main code. This means that one or
more correct/complete TPDUs could theoretically still be in the FIFO,
but the "Fast path" of the timeout handling is pre-empting that and
messing with the state machines.
All events from the UART should be delivered via the ring-buffer to make
sure they arrive in order at the main function.
The old "report timeout via change flags in separate USB message" code
is left in place. On the USB protocol we should keep it for
compatibility. Internally we should probably also migrate that over
to the new ring-buffer method in a second step.
Change-Id: I4434c6fcd59d1a425e9ded734bbc8b0411a0a0d8
---
M firmware/libcommon/source/sniffer.c
1 file changed, 73 insertions(+), 66 deletions(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index e87e9b8..75c140c 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -1,6 +1,6 @@
/* SIMtrace 2 sniffer mode
*
- * (C) 2016-2017 by Harald Welte <hwelte(a)hmw-consulting.de>
+ * (C) 2016-2022 by Harald Welte <hwelte(a)hmw-consulting.de>
* (C) 2018 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon(a)sysmocom.de>
*
* This program is free software; you can redistribute it and/or modify
@@ -115,6 +115,8 @@
#define RBUF16_F_OVERRUN 0x0100
#define RBUF16_F_FRAMING 0x0200
#define RBUF16_F_PARITY 0x0400
+#define RBUF16_F_TIMEOUT_WT 0x0800
+#define RBUF16_F_DATA_BYTE 0x8000
/*------------------------------------------------------------------------------
* Internal variables
@@ -825,13 +827,11 @@
uint32_t csr = sniff_usart.base->US_CSR;
uint16_t byte = 0;
- bool byte_received = false;
/* Verify if character has been received */
if (csr & US_CSR_RXRDY) {
- byte_received = true;
/* Read communication data byte between phone and SIM */
- byte = sniff_usart.base->US_RHR;
+ byte = RBUF16_F_DATA_BYTE | (sniff_usart.base->US_RHR & 0xff);
/* Reset WT timer */
wt_remaining = g_wt;
}
@@ -847,15 +847,11 @@
if (csr & (US_CSR_OVRE|US_CSR_FRAME|US_CSR_PARE))
sniff_usart.base->US_CR |= US_CR_RSTSTA;
- /* Store sniffed data (or error flags, or both) into buffer */
- if (byte_received || byte) {
- if (rbuf16_write(&sniff_buffer, byte) != 0)
- TRACE_ERROR("USART buffer full\n\r");
- }
-
/* Verify it WT timeout occurred, to detect unresponsive card */
if (csr & US_CSR_TIMEOUT) {
if (wt_remaining <= (sniff_usart.base->US_RTOR & 0xffff)) {
+ /* ensure the timeout is enqueued in the ring-buffer */
+ byte |= RBUF16_F_TIMEOUT_WT;
/* Just set the flag and let the main loop handle it */
change_flags |= SNIFF_CHANGE_FLAG_TIMEOUT_WT;
/* Reset timeout value */
@@ -875,6 +871,12 @@
sniff_usart.base->US_CR |= US_CR_RETTO;
}
}
+
+ /* Store sniffed data (or error flags, or both) into buffer */
+ if (byte) {
+ if (rbuf16_write(&sniff_buffer, byte) != 0)
+ TRACE_ERROR("USART buffer full\n\r");
+ }
}
/** PIO interrupt service routine to checks if the card reset line has changed
@@ -1023,43 +1025,72 @@
/* Handle sniffed data */
if (!rbuf16_is_empty(&sniff_buffer)) { /* use if instead of while to let the main loop restart the watchdog */
uint16_t entry = rbuf16_read(&sniff_buffer);
- uint8_t byte = entry & 0xff;
- /* Convert convention if required */
- if (convention_convert) {
- byte = convention_convert_lut[byte];
- }
- //TRACE_ERROR_WP(">%02x", byte);
- switch (iso_state) { /* Handle byte depending on state */
- case ISO7816_S_RESET: /* During reset we shouldn't receive any data */
- break;
- case ISO7816_S_WAIT_ATR: /* After a reset we expect the ATR */
- change_state(ISO7816_S_IN_ATR); /* go to next state */
- case ISO7816_S_IN_ATR: /* More ATR data incoming */
- process_byte_atr(byte);
- break;
- case ISO7816_S_WAIT_TPDU: /* After the ATR we expect TPDU or PPS data */
- case ISO7816_S_WAIT_PPS_RSP:
- if (0xff == byte) {
- if (ISO7816_S_WAIT_PPS_RSP == iso_state) {
- change_state(ISO7816_S_IN_PPS_RSP); /* Go to PPS state */
- } else {
- change_state(ISO7816_S_IN_PPS_REQ); /* Go to PPS state */
+
+ if (entry & RBUF16_F_DATA_BYTE) {
+ uint8_t byte = entry & 0xff;
+ /* Convert convention if required */
+ if (convention_convert) {
+ byte = convention_convert_lut[byte];
+ }
+
+ //TRACE_ERROR_WP(">%02x", byte);
+ switch (iso_state) { /* Handle byte depending on state */
+ case ISO7816_S_RESET: /* During reset we shouldn't receive any data */
+ break;
+ case ISO7816_S_WAIT_ATR: /* After a reset we expect the ATR */
+ change_state(ISO7816_S_IN_ATR); /* go to next state */
+ case ISO7816_S_IN_ATR: /* More ATR data incoming */
+ process_byte_atr(byte);
+ break;
+ case ISO7816_S_WAIT_TPDU: /* After the ATR we expect TPDU or PPS data */
+ case ISO7816_S_WAIT_PPS_RSP:
+ if (0xff == byte) {
+ if (ISO7816_S_WAIT_PPS_RSP == iso_state) {
+ change_state(ISO7816_S_IN_PPS_RSP); /* Go to PPS state */
+ } else {
+ change_state(ISO7816_S_IN_PPS_REQ); /* Go to PPS state */
+ }
+ process_byte_pps(byte);
+ break;
}
+ case ISO7816_S_IN_TPDU: /* More TPDU data incoming */
+ if (ISO7816_S_WAIT_TPDU == iso_state) {
+ change_state(ISO7816_S_IN_TPDU);
+ }
+ process_byte_tpdu(byte);
+ break;
+ case ISO7816_S_IN_PPS_REQ:
+ case ISO7816_S_IN_PPS_RSP:
process_byte_pps(byte);
break;
+ default:
+ TRACE_ERROR("Data received in unknown state %u\n\r", iso_state);
}
- case ISO7816_S_IN_TPDU: /* More TPDU data incoming */
- if (ISO7816_S_WAIT_TPDU == iso_state) {
- change_state(ISO7816_S_IN_TPDU);
+ }
+
+ /* Use timeout to detect interrupted data transmission */
+ if (entry & RBUF16_F_TIMEOUT_WT) {
+ TRACE_ERROR("USART TIMEOUT Error\n\r");
+ switch (iso_state) {
+ case ISO7816_S_IN_ATR:
+ led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
+ usb_send_atr(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete ATR to host software using USB */
+ change_state(ISO7816_S_WAIT_ATR);
+ break;
+ case ISO7816_S_IN_TPDU:
+ led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
+ usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete PPS to host software using USB */
+ change_state(ISO7816_S_WAIT_TPDU);
+ break;
+ case ISO7816_S_IN_PPS_REQ:
+ case ISO7816_S_IN_PPS_RSP:
+ led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
+ usb_send_pps(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete TPDU to host software using USB */
+ change_state(ISO7816_S_WAIT_TPDU);
+ break;
+ default:
+ break;
}
- process_byte_tpdu(byte);
- break;
- case ISO7816_S_IN_PPS_REQ:
- case ISO7816_S_IN_PPS_RSP:
- process_byte_pps(byte);
- break;
- default:
- TRACE_ERROR("Data received in unknown state %u\n\r", iso_state);
}
if (entry & RBUF16_F_PARITY)
@@ -1101,30 +1132,6 @@
printf("reset de-asserted\n\r");
}
}
- if (change_flags & SNIFF_CHANGE_FLAG_TIMEOUT_WT) {
- /* Use timeout to detect interrupted data transmission */
- switch (iso_state) {
- case ISO7816_S_IN_ATR:
- led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
- usb_send_atr(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete ATR to host software using USB */
- change_state(ISO7816_S_WAIT_ATR);
- break;
- case ISO7816_S_IN_TPDU:
- led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
- usb_send_tpdu(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete PPS to host software using USB */
- change_state(ISO7816_S_WAIT_TPDU);
- break;
- case ISO7816_S_IN_PPS_REQ:
- case ISO7816_S_IN_PPS_RSP:
- led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */
- usb_send_pps(SNIFF_DATA_FLAG_ERROR_INCOMPLETE); /* send incomplete TPDU to host software using USB */
- change_state(ISO7816_S_WAIT_TPDU);
- break;
- default:
- change_flags &= ~SNIFF_CHANGE_FLAG_TIMEOUT_WT; /* We don't care about the timeout is all other cases */
- break;
- }
- }
if (change_flags) {
usb_send_change(change_flags); /* send timeout to host software over USB */
change_flags = 0; /* Reset flags */
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30198
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I4434c6fcd59d1a425e9ded734bbc8b0411a0a0d8
Gerrit-Change-Number: 30198
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30188 )
Change subject: firmware/sniffer: Rename global variable 'wt' to 'g_wt'
......................................................................
firmware/sniffer: Rename global variable 'wt' to 'g_wt'
It's a bad idea to have a two-character global variable which might
easily clash with local variable names.
Change-Id: Ic2fac64129d2772a1923f35e48582be3b130a0f2
---
M firmware/libcommon/source/sniffer.c
1 file changed, 6 insertions(+), 6 deletions(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index 1368f0b..cedf634 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -189,7 +189,7 @@
/*! Waiting Time (WT)
* @note defined in ISO/IEC 7816-3:2006(E) section 8.1 and 10.2
*/
-static uint32_t wt = 9600;
+static uint32_t g_wt = 9600;
/*------------------------------------------------------------------------------
* Internal functions
@@ -219,8 +219,8 @@
if (0 != d) {
wt_d = d;
}
- wt = wt_wi * 960UL * wt_d;
- TRACE_INFO("WT updated (wi=%u, d=%u, cause=%s) to %lu ETU\n\r", wi, d, cause, wt);
+ g_wt = wt_wi * 960UL * wt_d;
+ TRACE_INFO("WT updated (wi=%u, d=%u, cause=%s) to %lu ETU\n\r", wi, d, cause, g_wt);
}
/*! Allocate USB buffer and push + initialize simtrace_msg_hdr
@@ -833,7 +833,7 @@
/* Read communication data byte between phone and SIM */
uint8_t byte = sniff_usart.base->US_RHR;
/* Reset WT timer */
- wt_remaining = wt;
+ wt_remaining = g_wt;
/* Store sniffed data into buffer (also clear interrupt */
if (rbuf_write(&sniff_buffer, byte) != 0)
TRACE_ERROR("USART buffer full\n\r");
@@ -845,7 +845,7 @@
/* Just set the flag and let the main loop handle it */
change_flags |= SNIFF_CHANGE_FLAG_TIMEOUT_WT;
/* Reset timeout value */
- wt_remaining = wt;
+ wt_remaining = g_wt;
} else {
wt_remaining -= (sniff_usart.base->US_RTOR & 0xffff); /* be sure to subtract the actual timeout since the new might not have been set and reloaded yet */
}
@@ -947,7 +947,7 @@
/* Only receive data when sniffing */
USART_SetReceiverEnabled(sniff_usart.base, 1);
/* Enable Receiver time-out to detect waiting time (WT) time-out (e.g. unresponsive cards) */
- sniff_usart.base->US_RTOR = wt;
+ sniff_usart.base->US_RTOR = g_wt;
/* Enable interrupt to indicate when data has been received or timeout occurred */
USART_EnableIt(sniff_usart.base, US_IER_RXRDY | US_IER_TIMEOUT);
/* Set USB priority lower than USART to not miss sniffing data (both at 0 per default) */
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30188
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ic2fac64129d2772a1923f35e48582be3b130a0f2
Gerrit-Change-Number: 30188
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30189 )
Change subject: firmware/sniffer: Disable TIMEOUT interrupts in USART IER on exit
......................................................................
firmware/sniffer: Disable TIMEOUT interrupts in USART IER on exit
Not critical (we disable the USART interrupts in NVIC anyway), but
if Sniffer_init() enables this flag, it's good style for Sniffer_exit()
to disable it.
Change-Id: I92e16a160d60fcab33c81e0cf074088b9f20b9ae
---
M firmware/libcommon/source/sniffer.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index cedf634..153c483 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -913,7 +913,7 @@
{
TRACE_INFO("Sniffer exit\n\r");
/* Disable USART */
- USART_DisableIt(sniff_usart.base, US_IER_RXRDY);
+ USART_DisableIt(sniff_usart.base, US_IER_RXRDY | US_IER_TIMEOUT);
/* NOTE: don't forget to set the IRQ according to the USART peripheral used */
NVIC_DisableIRQ(IRQ_USART_SIM);
USART_SetReceiverEnabled(sniff_usart.base, 0);
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30189
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I92e16a160d60fcab33c81e0cf074088b9f20b9ae
Gerrit-Change-Number: 30189
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30182 )
Change subject: firmware/sniffer: Make all global variables 'static'
......................................................................
firmware/sniffer: Make all global variables 'static'
None of those variables are used outside sniffer.c, so they can all be
static.
Change-Id: I8946acb6189d5ade57214295f0ba87f0608bad92
---
M firmware/libcommon/source/sniffer.c
1 file changed, 14 insertions(+), 14 deletions(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index da5d743..8deda9c 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -141,47 +141,47 @@
static struct ringbuf sniff_buffer;
/* Flags to know is the card status changed (see SIMTRACE_MSGT_DT_SNIFF_CHANGE flags) */
-volatile uint32_t change_flags = 0;
+static volatile uint32_t change_flags = 0;
/* ISO 7816 variables */
/*! ISO 7816-3 state */
-enum iso7816_3_sniff_state iso_state = ISO7816_S_RESET;
+static enum iso7816_3_sniff_state iso_state = ISO7816_S_RESET;
/*! ATR state */
-enum atr_sniff_state atr_state;
+static enum atr_sniff_state atr_state;
/*! ATR data
* @remark can be used to check later protocol changes
*/
-uint8_t atr[MAX_ATR_SIZE];
+static uint8_t atr[MAX_ATR_SIZE];
/*! Current index in the ATR data */
-uint8_t atr_i = 0;
+static uint8_t atr_i = 0;
/*! If convention conversion is needed */
-bool convention_convert = false;
+static bool convention_convert = false;
/*! The supported T protocols */
-uint16_t t_protocol_support = 0;
+static uint16_t t_protocol_support = 0;
/*! PPS state
* @remark it is shared between request and response since they aren't simultaneous but follow the same procedure
*/
-enum pps_sniff_state pps_state;
+static enum pps_sniff_state pps_state;
/*! PPS request data
* @remark can be used to check PPS response
*/
-uint8_t pps_req[MAX_PPS_SIZE];
+static uint8_t pps_req[MAX_PPS_SIZE];
/*! PPS response data */
-uint8_t pps_rsp[MAX_PPS_SIZE];
+static uint8_t pps_rsp[MAX_PPS_SIZE];
/*! TPDU state */
-enum tpdu_sniff_state tpdu_state;
+static enum tpdu_sniff_state tpdu_state;
/*! Final TPDU packet
* @note this is the complete command+response TPDU, including header, data, and status words
* @remark this does not include the procedure bytes
*/
-uint8_t tpdu_packet[5+256+2];
+static uint8_t tpdu_packet[5+256+2];
/*! Current index in TPDU packet */
-uint16_t tpdu_packet_i = 0;
+static uint16_t tpdu_packet_i = 0;
/*! Waiting Time (WT)
* @note defined in ISO/IEC 7816-3:2006(E) section 8.1 and 10.2
*/
-uint32_t wt = 9600;
+static uint32_t wt = 9600;
/*------------------------------------------------------------------------------
* Internal functions
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30182
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I8946acb6189d5ade57214295f0ba87f0608bad92
Gerrit-Change-Number: 30182
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon(a)sysmocom.de>
Gerrit-MessageType: merged
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30180 )
Change subject: firmware/sniffer: Avoid extra call for rbuf_is_full
......................................................................
firmware/sniffer: Avoid extra call for rbuf_is_full
rbuf_write() will tell us in the return value if the buffer was full
(error) or not (success). Let's use that return value rather than a
theoretically race-y call to rbuf_is_full() before.
It's theoretical as the write happens from IRQ context and the read from
normal process context, so the fill-level cannot really change while
we're in the USART interrupt. So it doesn't fix a bug, just improves
coding style and also avoids an extra function call + irq-disable/re-enable.
Change-Id: Icf570d0aa48d67a19e63c6e2b6caa14438fe88e3
---
M firmware/libcommon/source/sniffer.c
1 file changed, 1 insertion(+), 4 deletions(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index e3b7fbb..cbfa7c9 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -826,11 +826,8 @@
/* Reset WT timer */
wt_remaining = wt;
/* Store sniffed data into buffer (also clear interrupt */
- if (rbuf_is_full(&sniff_buffer)) {
+ if (rbuf_write(&sniff_buffer, byte) != 0)
TRACE_ERROR("USART buffer full\n\r");
- } else {
- rbuf_write(&sniff_buffer, byte);
- }
}
/* Verify it WT timeout occurred, to detect unresponsive card */
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30180
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Icf570d0aa48d67a19e63c6e2b6caa14438fe88e3
Gerrit-Change-Number: 30180
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: tsaitgaist <kredon(a)sysmocom.de>
Gerrit-MessageType: merged