This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Kévin Redon gerrit-no-reply at lists.osmocom.orgKévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/10211
Change subject: sniff: ensure the checksum error flag is also printed
......................................................................
sniff: ensure the checksum error flag is also printed
the firmware now also use a generic value_string array (as does the
host application)
Change-Id: I861bd8b52e8f2f2a4786bbe1cc834917119dc394
---
M firmware/libcommon/source/sniffer.c
M host/simtrace2-sniff.c
2 files changed, 36 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/11/10211/1
diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c
index e800216..5cf96fd 100644
--- a/firmware/libcommon/source/sniffer.c
+++ b/firmware/libcommon/source/sniffer.c
@@ -302,6 +302,38 @@
//TRACE_INFO("Changed to ISO 7816-3 state %u\n\r", iso_state); /* don't print since this is function is also called by ISRs */
}
+const struct value_string data_flags[] = {
+ {
+ .value = SNIFF_DATA_FLAG_ERROR_INCOMPLETE,
+ .str = "incomplete",
+ },
+ {
+ .value = SNIFF_DATA_FLAG_ERROR_MALFORMED,
+ .str = "malformed",
+ },
+ {
+ .value = SNIFF_DATA_FLAG_ERROR_CHECKSUM,
+ .str = "checksum error",
+ },
+ {
+ .value = 0,
+ .str = NULL,
+ },
+};
+
+static void print_flags(const struct value_string* flag_meanings, uint32_t nb_flags, uint32_t flags) {
+ uint32_t i;
+ for (i = 0; i < nb_flags; i++) {
+ if (flags & flag_meanings[i].value) {
+ printf(flag_meanings[i].str);
+ flags &= ~flag_meanings[i].value;
+ if (flags) {
+ printf(", ");
+ }
+ }
+ }
+}
+
static void usb_send_data(enum simtrace_msg_type_sniff type, const uint8_t* data, uint16_t length, uint32_t flags)
{
/* Sanity check */
@@ -329,20 +361,7 @@
}
if (flags) {
printf(" (");
- if (flags & SNIFF_DATA_FLAG_ERROR_INCOMPLETE) {
- printf("incomplete");
- flags &= ~SNIFF_DATA_FLAG_ERROR_INCOMPLETE;
- if (flags) {
- printf(", ");
- }
- }
- if (flags & SNIFF_DATA_FLAG_ERROR_MALFORMED) {
- printf("malformed");
- flags &= ~SNIFF_DATA_FLAG_ERROR_MALFORMED;
- if (flags) {
- printf(", ");
- }
- }
+ print_flags(data_flags, ARRAY_SIZE(data_flags), flags);
putchar(')');
}
printf(": ");
diff --git a/host/simtrace2-sniff.c b/host/simtrace2-sniff.c
index aeacc6b..4ba43f4 100644
--- a/host/simtrace2-sniff.c
+++ b/host/simtrace2-sniff.c
@@ -131,14 +131,13 @@
.value = SNIFF_DATA_FLAG_ERROR_MALFORMED,
.str = "malformed",
},
+ .value = SNIFF_DATA_FLAG_ERROR_CHECKSUM,
+ .str = "checksum error",
+ },
{
.value = 0,
.str = NULL,
},
- {
- .value = SNIFF_DATA_FLAG_ERROR_CHECKSUM,
- .str = "checksum error",
- },
};
static void print_flags(const struct value_string* flag_meanings, uint32_t nb_flags, uint32_t flags) {
--
To view, visit https://gerrit.osmocom.org/10211
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I861bd8b52e8f2f2a4786bbe1cc834917119dc394
Gerrit-Change-Number: 10211
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180728/a5443c43/attachment.htm>