lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

November 2022

  • 2 participants
  • 2503 discussions
Change in libosmo-netif[master]: osmux: Rework log formatting when replaying detected RTP gaps
by pespin 16 Nov '22

16 Nov '22
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/30148 ) Change subject: osmux: Rework log formatting when replaying detected RTP gaps ...................................................................... Patch Set 1: (1 comment) File src/osmux_input.c: https://gerrit.osmocom.org/c/libosmo-netif/+/30148/comment/6326fda2_317947ac PS1, Line 366: d > Ack @laforge this calculation seems to be correct due to how unsigned subtraction and conversion to signed works. This is also how the before() and after() functions are implemented in the linux kernel. Checked with a unit test in gdb: 448 diff = cur_seq - last_seq; (gdb) print last_seq $4 = 65535 (gdb) print cur_seq $5 = 1 (gdb) n 453 if (diff <= 1) (gdb) print diff $6 = 2 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/30148 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I5fd64acf7bc1e53efae0674d0c906d1255a9bbf6 Gerrit-Change-Number: 30148 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Comment-Date: Wed, 16 Nov 2022 11:04:08 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
Change in simtrace2[master]: firmware/sniffer: Make all global variables 'static'
by laforge 16 Nov '22

16 Nov '22
laforge has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/82/30182/1 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: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: firmware/sniffer: Group global variables in structs
by laforge 16 Nov '22

16 Nov '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/30183 ) Change subject: firmware/sniffer: Group global variables in structs ...................................................................... firmware/sniffer: Group global variables in structs This is a purely cosmetic change that groups PPS, TPDU and ATR related global variables into structs. The structs get g_ prefixes to indicate a global variable. This avoids confusion between very short/generic variable names that might clash with local variables. Change-Id: I3e02f6c6b063ebc860b7a2a54dfc6051f1ea584f --- M firmware/libcommon/source/sniffer.c 1 file changed, 102 insertions(+), 94 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/83/30183/1 diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c index 8deda9c..cca140d 100644 --- a/firmware/libcommon/source/sniffer.c +++ b/firmware/libcommon/source/sniffer.c @@ -146,37 +146,45 @@ /* ISO 7816 variables */ /*! ISO 7816-3 state */ static enum iso7816_3_sniff_state iso_state = ISO7816_S_RESET; -/*! ATR state */ -static enum atr_sniff_state atr_state; -/*! ATR data - * @remark can be used to check later protocol changes - */ -static uint8_t atr[MAX_ATR_SIZE]; -/*! Current index in the ATR data */ -static uint8_t atr_i = 0; + +static struct { + /*! ATR state */ + enum atr_sniff_state state; + /*! ATR data + * @remark can be used to check later protocol changes + */ + uint8_t atr[MAX_ATR_SIZE]; + /*! Current index in the ATR data */ + uint8_t atr_i; +} g_atr; + /*! If convention conversion is needed */ static bool convention_convert = false; /*! The supported T protocols */ 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 - */ -static enum pps_sniff_state pps_state; -/*! PPS request data - * @remark can be used to check PPS response - */ -static uint8_t pps_req[MAX_PPS_SIZE]; -/*! PPS response data */ -static uint8_t pps_rsp[MAX_PPS_SIZE]; -/*! 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 - */ -static uint8_t tpdu_packet[5+256+2]; -/*! Current index in TPDU packet */ -static uint16_t tpdu_packet_i = 0; + +static struct { + /*! PPS state + * @remark it is shared between request and response since they aren't simultaneous but + * follow the same procedure */ + enum pps_sniff_state state; + /*! PPS request data + * @remark can be used to check PPS response */ + uint8_t req[MAX_PPS_SIZE]; + /*! PPS response data */ + uint8_t rsp[MAX_PPS_SIZE]; +} g_pps; + +static struct { + /*! TPDU state */ + enum tpdu_sniff_state 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 packet[5+256+2]; + /*! Current index in TPDU packet */ + uint16_t packet_i; +} g_tpdu; /*! Waiting Time (WT) * @note defined in ISO/IEC 7816-3:2006(E) section 8.1 and 10.2 @@ -260,8 +268,8 @@ */ static void change_tpdu_state(enum tpdu_sniff_state tpdu_state_new) { - //TRACE_ERROR("TPDU state %u->%u\n\r", tpdu_state, tpdu_state_new); - tpdu_state = tpdu_state_new; + //TRACE_ERROR("TPDU state %u->%u\n\r", g_tpdu.state, tpdu_state_new); + g_tpdu.state = tpdu_state_new; } /*! Update the ISO 7816-3 state @@ -285,18 +293,18 @@ rbuf_reset(&sniff_buffer); /* reset buffer for new communication */ break; case ISO7816_S_IN_ATR: - atr_i = 0; + g_atr.atr_i = 0; convention_convert = false; t_protocol_support = 0; - atr_state = ATR_S_WAIT_TS; + g_atr.state = ATR_S_WAIT_TS; break; case ISO7816_S_IN_PPS_REQ: case ISO7816_S_IN_PPS_RSP: - pps_state = PPS_S_WAIT_PPSS; + g_pps.state = PPS_S_WAIT_PPSS; break; case ISO7816_S_WAIT_TPDU: change_tpdu_state(TPDU_S_CLA); - tpdu_packet_i = 0; + g_tpdu.packet_i = 0; break; default: break; @@ -390,13 +398,13 @@ TRACE_WARNING("Can't print ATR in ISO 7816-3 state %u\n\r", iso_state); return; } - if (atr_i >= ARRAY_SIZE(atr)) { + if (g_atr.atr_i >= ARRAY_SIZE(g_atr.atr)) { TRACE_ERROR("ATR buffer overflow\n\r"); return; } /* Send ATR over USB */ - usb_send_data(SIMTRACE_MSGT_SNIFF_ATR, atr, atr_i, flags); + usb_send_data(SIMTRACE_MSGT_SNIFF_ATR, g_atr.atr, g_atr.atr_i, flags); } /*! Process ATR byte @@ -414,16 +422,16 @@ TRACE_ERROR("Processing ATR data in wrong ISO 7816-3 state %u\n\r", iso_state); return; } - if (atr_i >= ARRAY_SIZE(atr)) { + if (g_atr.atr_i >= ARRAY_SIZE(g_atr.atr)) { TRACE_ERROR("ATR data overflow\n\r"); return; } /* save data for use by other functions */ - atr[atr_i++] = byte; + g_atr.atr[g_atr.atr_i++] = byte; /* handle ATR byte depending on current state */ - switch (atr_state) { + switch (g_atr.state) { case ATR_S_WAIT_TS: /* see ISO/IEC 7816-3:2006 section 8.1 */ flags = 0; switch (byte) { @@ -432,7 +440,7 @@ convention_convert = !convention_convert; case 0x3b: /* direct convention used and correctly decoded */ case 0x3f: /* inverse convention used and correctly decoded */ - atr_state = ATR_S_WAIT_T0; /* wait for format byte */ + g_atr.state = ATR_S_WAIT_T0; /* wait for format byte */ break; default: TRACE_WARNING("Invalid TS received\n\r"); @@ -445,30 +453,30 @@ break; case ATR_S_WAIT_T0: /* see ISO/IEC 7816-3:2006 section 8.2.2 */ case ATR_S_WAIT_TD: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ - if (ATR_S_WAIT_T0 == atr_state) { + if (ATR_S_WAIT_T0 == g_atr.state) { atr_hist_len = (byte & 0x0f); /* save the number of historical bytes */ - } else if (ATR_S_WAIT_TD == atr_state) { + } else if (ATR_S_WAIT_TD == g_atr.state) { t_protocol_support |= (1<<(byte & 0x0f)); /* remember supported protocol to know if TCK will be present */ } y = (byte & 0xf0); /* remember upcoming interface bytes */ i++; /* next interface byte sub-group is coming */ if (y & 0x10) { - atr_state = ATR_S_WAIT_TA; /* wait for interface byte TA */ + g_atr.state = ATR_S_WAIT_TA; /* wait for interface byte TA */ break; } case ATR_S_WAIT_TA: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ if (y & 0x20) { - atr_state = ATR_S_WAIT_TB; /* wait for interface byte TB */ + g_atr.state = ATR_S_WAIT_TB; /* wait for interface byte TB */ break; } case ATR_S_WAIT_TB: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ if (y & 0x40) { - atr_state = ATR_S_WAIT_TC; /* wait for interface byte TC */ + g_atr.state = ATR_S_WAIT_TC; /* wait for interface byte TC */ break; } case ATR_S_WAIT_TC: /* see ISO/IEC 7816-3:2006 section 8.2.3 */ /* retrieve WI encoded in TC2*/ - if (ATR_S_WAIT_TC==atr_state && 2==i) { + if (ATR_S_WAIT_TC == g_atr.state && 2==i) { if (0 == byte) { update_wt(10, 0); } else { @@ -476,10 +484,10 @@ } } if (y & 0x80) { - atr_state = ATR_S_WAIT_TD; /* wait for interface byte TD */ + g_atr.state = ATR_S_WAIT_TD; /* wait for interface byte TD */ break; } else if (atr_hist_len) { - atr_state = ATR_S_WAIT_HIST; /* wait for historical bytes */ + g_atr.state = ATR_S_WAIT_HIST; /* wait for historical bytes */ break; } case ATR_S_WAIT_HIST: /* see ISO/IEC 7816-3:2006 section 8.2.4 */ @@ -488,7 +496,7 @@ } if (0 == atr_hist_len) { if (t_protocol_support > 1) { - atr_state = ATR_S_WAIT_TCK; /* wait for check bytes */ + g_atr.state = ATR_S_WAIT_TCK; /* wait for check bytes */ break; } } else { @@ -496,11 +504,11 @@ } case ATR_S_WAIT_TCK: /* see ISO/IEC 7816-3:2006 section 8.2.5 */ /* verify checksum if present */ - if (ATR_S_WAIT_TCK == atr_state) { + if (ATR_S_WAIT_TCK == g_atr.state) { uint8_t ui; uint8_t checksum = 0; - for (ui = 1; ui < atr_i; ui++) { - checksum ^= atr[ui]; + for (ui = 1; ui < g_atr.atr_i; ui++) { + checksum ^= g_atr.atr[ui]; } if (checksum) { flags |= SNIFF_DATA_FLAG_ERROR_CHECKSUM; @@ -513,7 +521,7 @@ change_state(ISO7816_S_WAIT_TPDU); /* go to next state */ break; default: - TRACE_INFO("Unknown ATR state %u\n\r", atr_state); + TRACE_INFO("Unknown ATR state %u\n\r", g_atr.state); } } @@ -527,9 +535,9 @@ /* Sanity check */ if (ISO7816_S_IN_PPS_REQ == iso_state) { - pps_cur = pps_req; + pps_cur = g_pps.req; } else if (ISO7816_S_IN_PPS_RSP == iso_state) { - pps_cur = pps_rsp; + pps_cur = g_pps.rsp; } else { TRACE_ERROR("Can't print PPS in ISO 7816-3 state %u\n\r", iso_state); return; @@ -538,22 +546,22 @@ /* Get only relevant data */ uint8_t pps[6]; uint8_t pps_i = 0; - if (pps_state > PPS_S_WAIT_PPSS) { + if (g_pps.state > PPS_S_WAIT_PPSS) { pps[pps_i++] = pps_cur[0]; } - if (pps_state > PPS_S_WAIT_PPS0) { + if (g_pps.state > PPS_S_WAIT_PPS0) { pps[pps_i++] = pps_cur[1]; } - if (pps_state > PPS_S_WAIT_PPS1 && pps_cur[1] & 0x10) { + if (g_pps.state > PPS_S_WAIT_PPS1 && pps_cur[1] & 0x10) { pps[pps_i++] = pps_cur[2]; } - if (pps_state > PPS_S_WAIT_PPS2 && pps_cur[1] & 0x20) { + if (g_pps.state > PPS_S_WAIT_PPS2 && pps_cur[1] & 0x20) { pps[pps_i++] = pps_cur[3]; } - if (pps_state > PPS_S_WAIT_PPS3 && pps_cur[1] & 0x40) { + if (g_pps.state > PPS_S_WAIT_PPS3 && pps_cur[1] & 0x40) { pps[pps_i++] = pps_cur[4]; } - if (pps_state > PPS_S_WAIT_PCK) { + if (g_pps.state > PPS_S_WAIT_PCK) { pps[pps_i++] = pps_cur[5]; } @@ -583,21 +591,21 @@ /* sanity check */ if (ISO7816_S_IN_PPS_REQ == iso_state) { - pps_cur = pps_req; + pps_cur = g_pps.req; } else if (ISO7816_S_IN_PPS_RSP == iso_state) { - pps_cur = pps_rsp; + pps_cur = g_pps.rsp; } else { TRACE_ERROR("Processing PPS data in wrong ISO 7816-3 state %u\n\r", iso_state); return; } /* handle PPS byte depending on current state */ - switch (pps_state) { /* see ISO/IEC 7816-3:2006 section 9.2 */ + switch (g_pps.state) { /* see ISO/IEC 7816-3:2006 section 9.2 */ case PPS_S_WAIT_PPSS: /*!< initial byte */ flags = 0; if (byte == 0xff) { pps_cur[0] = byte; - pps_state = PPS_S_WAIT_PPS0; /* go to next state */ + g_pps.state = PPS_S_WAIT_PPS0; /* go to next state */ } else { TRACE_INFO("Invalid PPSS received\n\r"); led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */ @@ -608,24 +616,24 @@ case PPS_S_WAIT_PPS0: /*!< format byte */ pps_cur[1] = byte; if (pps_cur[1] & 0x10) { - pps_state = PPS_S_WAIT_PPS1; /* go to next state */ + g_pps.state = PPS_S_WAIT_PPS1; /* go to next state */ break; } case PPS_S_WAIT_PPS1: /*!< first parameter byte */ pps_cur[2] = byte; /* not always right but doesn't affect the process */ if (pps_cur[1] & 0x20) { - pps_state = PPS_S_WAIT_PPS2; /* go to next state */ + g_pps.state = PPS_S_WAIT_PPS2; /* go to next state */ break; } case PPS_S_WAIT_PPS2: /*!< second parameter byte */ pps_cur[3] = byte; /* not always right but doesn't affect the process */ if (pps_cur[1] & 0x40) { - pps_state = PPS_S_WAIT_PPS3; /* go to next state */ + g_pps.state = PPS_S_WAIT_PPS3; /* go to next state */ break; } case PPS_S_WAIT_PPS3: /*!< third parameter byte */ pps_cur[4] = byte; /* not always right but doesn't affect the process */ - pps_state = PPS_S_WAIT_PCK; /* go to next state */ + g_pps.state = PPS_S_WAIT_PCK; /* go to next state */ break; case PPS_S_WAIT_PCK: /*!< check byte */ pps_cur[5] = byte; /* not always right but doesn't affect the process */ @@ -646,7 +654,7 @@ if (check) { flags |= SNIFF_DATA_FLAG_ERROR_CHECKSUM; } - pps_state = PPS_S_WAIT_END; + g_pps.state = PPS_S_WAIT_END; usb_send_pps(flags); /* send PPS to host software using USB */ if (ISO7816_S_IN_PPS_REQ == iso_state) { if (0 == check) { /* checksum is valid */ @@ -676,10 +684,10 @@ } break; case PPS_S_WAIT_END: - TRACE_WARNING("Unexpected PPS received %u\n\r", pps_state); + TRACE_WARNING("Unexpected PPS received %u\n\r", g_pps.state); break; default: - TRACE_WARNING("Unknown PPS state %u\n\r", pps_state); + TRACE_WARNING("Unknown PPS state %u\n\r", g_pps.state); break; } } @@ -697,7 +705,7 @@ } /* Send ATR over USB */ - usb_send_data(SIMTRACE_MSGT_SNIFF_TPDU, tpdu_packet, tpdu_packet_i, flags); + usb_send_data(SIMTRACE_MSGT_SNIFF_TPDU, g_tpdu.packet, g_tpdu.packet_i, flags); } static void process_byte_tpdu(uint8_t byte) @@ -707,13 +715,13 @@ TRACE_ERROR("Processing TPDU data in wrong ISO 7816-3 state %u\n\r", iso_state); return; } - if (tpdu_packet_i >= ARRAY_SIZE(tpdu_packet)) { + if (g_tpdu.packet_i >= ARRAY_SIZE(g_tpdu.packet)) { TRACE_ERROR("TPDU data overflow\n\r"); return; } /* handle TPDU byte depending on current state */ - switch (tpdu_state) { + switch (g_tpdu.state) { case TPDU_S_CLA: if (0xff == byte) { TRACE_WARNING("0xff is not a valid class byte\n\r"); @@ -722,8 +730,8 @@ change_state(ISO7816_S_WAIT_TPDU); /* go back to TPDU state */ return; } - tpdu_packet_i = 0; - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet_i = 0; + g_tpdu.packet[g_tpdu.packet_i++] = byte; change_tpdu_state(TPDU_S_INS); break; case TPDU_S_INS: @@ -734,38 +742,38 @@ change_state(ISO7816_S_WAIT_TPDU); /* go back to TPDU state */ return; } - tpdu_packet_i = 1; - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet_i = 1; + g_tpdu.packet[g_tpdu.packet_i++] = byte; change_tpdu_state(TPDU_S_P1); break; case TPDU_S_P1: - tpdu_packet_i = 2; - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet_i = 2; + g_tpdu.packet[g_tpdu.packet_i++] = byte; change_tpdu_state(TPDU_S_P2); break; case TPDU_S_P2: - tpdu_packet_i = 3; - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet_i = 3; + g_tpdu.packet[g_tpdu.packet_i++] = byte; change_tpdu_state(TPDU_S_P3); break; case TPDU_S_P3: - tpdu_packet_i = 4; - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet_i = 4; + g_tpdu.packet[g_tpdu.packet_i++] = byte; change_tpdu_state(TPDU_S_PROCEDURE); break; case TPDU_S_PROCEDURE: if (0x60 == byte) { /* wait for next procedure byte */ break; - } else if (tpdu_packet[1] == byte) { /* get all remaining data bytes */ + } else if (g_tpdu.packet[1] == byte) { /* get all remaining data bytes */ change_tpdu_state(TPDU_S_DATA_REMAINING); break; - } else if ((~tpdu_packet[1]) == byte) { /* get single data byte */ + } else if ((~g_tpdu.packet[1]) == byte) { /* get single data byte */ change_tpdu_state(TPDU_S_DATA_SINGLE); break; } case TPDU_S_SW1: if ((0x60 == (byte & 0xf0)) || (0x90 == (byte & 0xf0))) { /* this procedure byte is SW1 */ - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet[g_tpdu.packet_i++] = byte; change_tpdu_state(TPDU_S_SW2); } else { TRACE_WARNING("invalid SW1 0x%02x\n\r", byte); @@ -776,28 +784,28 @@ } break; case TPDU_S_SW2: - tpdu_packet[tpdu_packet_i++] = byte; + g_tpdu.packet[g_tpdu.packet_i++] = byte; usb_send_tpdu(0); /* send TPDU to host software using USB */ change_state(ISO7816_S_WAIT_TPDU); /* this is the end of the TPDU */ break; case TPDU_S_DATA_SINGLE: case TPDU_S_DATA_REMAINING: - tpdu_packet[tpdu_packet_i++] = byte; - if (0 == tpdu_packet[4]) { - if (5+256 <= tpdu_packet_i) { + g_tpdu.packet[g_tpdu.packet_i++] = byte; + if (0 == g_tpdu.packet[4]) { + if (5+256 <= g_tpdu.packet_i) { change_tpdu_state(TPDU_S_PROCEDURE); } } else { - if (5+tpdu_packet[4] <= tpdu_packet_i) { + if (5+g_tpdu.packet[4] <= g_tpdu.packet_i) { change_tpdu_state(TPDU_S_PROCEDURE); } } - if (TPDU_S_DATA_SINGLE == tpdu_state) { + if (TPDU_S_DATA_SINGLE == g_tpdu.state) { change_tpdu_state(TPDU_S_PROCEDURE); } break; default: - TRACE_ERROR("unhandled TPDU state %u\n\r", tpdu_state); + TRACE_ERROR("unhandled TPDU state %u\n\r", g_tpdu.state); } } -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30183 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I3e02f6c6b063ebc860b7a2a54dfc6051f1ea584f Gerrit-Change-Number: 30183 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: firmware/sniffer: Fix programming error in PPS
by laforge 16 Nov '22

16 Nov '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/30181 ) Change subject: firmware/sniffer: Fix programming error in PPS ...................................................................... firmware/sniffer: Fix programming error in PPS process_byte_pps() would never enter the error path in which the first byte would be != 0xff. However, the caller already verified this before calling process_byte_pps() so the error path should never be hit anyway. Change-Id: Ia74b6338219a6965e6bd35a6efcf369890e02d81 --- M firmware/libcommon/source/sniffer.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/81/30181/1 diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c index cbfa7c9..da5d743 100644 --- a/firmware/libcommon/source/sniffer.c +++ b/firmware/libcommon/source/sniffer.c @@ -595,7 +595,7 @@ switch (pps_state) { /* see ISO/IEC 7816-3:2006 section 9.2 */ case PPS_S_WAIT_PPSS: /*!< initial byte */ flags = 0; - if (0xff) { + if (byte == 0xff) { pps_cur[0] = byte; pps_state = PPS_S_WAIT_PPS0; /* go to next state */ } else { -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30181 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: Ia74b6338219a6965e6bd35a6efcf369890e02d81 Gerrit-Change-Number: 30181 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: firmware/sniffer: Log old and new state in ISO7816-3 state changes
by laforge 16 Nov '22

16 Nov '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/30179 ) Change subject: firmware/sniffer: Log old and new state in ISO7816-3 state changes ...................................................................... firmware/sniffer: Log old and new state in ISO7816-3 state changes Change-Id: Iddb460cc2ad02c11a74de10dab127bb14cee9605 --- M firmware/libcommon/source/sniffer.c 1 file changed, 2 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/79/30179/1 diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c index 1647e17..e3b7fbb 100644 --- a/firmware/libcommon/source/sniffer.c +++ b/firmware/libcommon/source/sniffer.c @@ -302,9 +302,10 @@ break; } + TRACE_INFO("ISO 7816-3 state %u->%u\n\r", iso_state, iso_state_new); + /* save new state */ iso_state = iso_state_new; - TRACE_INFO("Changed to ISO 7816-3 state %u\n\r", iso_state); } const struct value_string data_flags[] = { -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30179 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: Iddb460cc2ad02c11a74de10dab127bb14cee9605 Gerrit-Change-Number: 30179 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: firmware/sniffer: Avoid extra call for rbuf_is_full
by laforge 16 Nov '22

16 Nov '22
laforge has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/80/30180/1 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: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: firmware/sniffer: refactor setting TPDU state
by laforge 16 Nov '22

16 Nov '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/30178 ) Change subject: firmware/sniffer: refactor setting TPDU state ...................................................................... firmware/sniffer: refactor setting TPDU state In low-level debugging it might be useful to trace the TPDU state changes, so let's factor-out the state-setting as a function that can be amended with printf() or GPIO toggles or the like. No logical change is introduced here, just assignments replaced with calling a function that does the assignment. compiler should inline that. Change-Id: Ie61321404f3686234c61c68a07d6cb9f5830ddc1 --- M firmware/libcommon/source/sniffer.c 1 file changed, 21 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/78/30178/1 diff --git a/firmware/libcommon/source/sniffer.c b/firmware/libcommon/source/sniffer.c index 13ef506..1647e17 100644 --- a/firmware/libcommon/source/sniffer.c +++ b/firmware/libcommon/source/sniffer.c @@ -255,6 +255,15 @@ usb_buf_submit(usb_msg); } +/*! Update the TPDU state + * @param[in] tpdu_state_new new TPDU state to update to + */ +static void change_tpdu_state(enum tpdu_sniff_state tpdu_state_new) +{ + //TRACE_ERROR("TPDU state %u->%u\n\r", tpdu_state, tpdu_state_new); + tpdu_state = tpdu_state_new; +} + /*! Update the ISO 7816-3 state * @param[in] iso_state_new new ISO 7816-3 state to update to */ @@ -286,7 +295,7 @@ pps_state = PPS_S_WAIT_PPSS; break; case ISO7816_S_WAIT_TPDU: - tpdu_state = TPDU_S_CLA; + change_tpdu_state(TPDU_S_CLA); tpdu_packet_i = 0; break; default: @@ -714,7 +723,7 @@ } tpdu_packet_i = 0; tpdu_packet[tpdu_packet_i++] = byte; - tpdu_state = TPDU_S_INS; + change_tpdu_state(TPDU_S_INS); break; case TPDU_S_INS: if ((0x60 == (byte & 0xf0)) || (0x90 == (byte & 0xf0))) { @@ -726,37 +735,37 @@ } tpdu_packet_i = 1; tpdu_packet[tpdu_packet_i++] = byte; - tpdu_state = TPDU_S_P1; + change_tpdu_state(TPDU_S_P1); break; case TPDU_S_P1: tpdu_packet_i = 2; tpdu_packet[tpdu_packet_i++] = byte; - tpdu_state = TPDU_S_P2; + change_tpdu_state(TPDU_S_P2); break; case TPDU_S_P2: tpdu_packet_i = 3; tpdu_packet[tpdu_packet_i++] = byte; - tpdu_state = TPDU_S_P3; + change_tpdu_state(TPDU_S_P3); break; case TPDU_S_P3: tpdu_packet_i = 4; tpdu_packet[tpdu_packet_i++] = byte; - tpdu_state = TPDU_S_PROCEDURE; + change_tpdu_state(TPDU_S_PROCEDURE); break; case TPDU_S_PROCEDURE: if (0x60 == byte) { /* wait for next procedure byte */ break; } else if (tpdu_packet[1] == byte) { /* get all remaining data bytes */ - tpdu_state = TPDU_S_DATA_REMAINING; + change_tpdu_state(TPDU_S_DATA_REMAINING); break; } else if ((~tpdu_packet[1]) == byte) { /* get single data byte */ - tpdu_state = TPDU_S_DATA_SINGLE; + change_tpdu_state(TPDU_S_DATA_SINGLE); break; } case TPDU_S_SW1: if ((0x60 == (byte & 0xf0)) || (0x90 == (byte & 0xf0))) { /* this procedure byte is SW1 */ tpdu_packet[tpdu_packet_i++] = byte; - tpdu_state = TPDU_S_SW2; + change_tpdu_state(TPDU_S_SW2); } else { TRACE_WARNING("invalid SW1 0x%02x\n\r", byte); led_blink(LED_RED, BLINK_2F_O); /* indicate error to user */ @@ -775,15 +784,15 @@ tpdu_packet[tpdu_packet_i++] = byte; if (0 == tpdu_packet[4]) { if (5+256 <= tpdu_packet_i) { - tpdu_state = TPDU_S_PROCEDURE; + change_tpdu_state(TPDU_S_PROCEDURE); } } else { if (5+tpdu_packet[4] <= tpdu_packet_i) { - tpdu_state = TPDU_S_PROCEDURE; + change_tpdu_state(TPDU_S_PROCEDURE); } } if (TPDU_S_DATA_SINGLE == tpdu_state) { - tpdu_state = TPDU_S_PROCEDURE; + change_tpdu_state(TPDU_S_PROCEDURE); } break; default: -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30178 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: Ie61321404f3686234c61c68a07d6cb9f5830ddc1 Gerrit-Change-Number: 30178 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: conrtrib/upload : upload elf files
by laforge 16 Nov '22

16 Nov '22
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/30153 ) Change subject: conrtrib/upload : upload elf files ...................................................................... conrtrib/upload : upload elf files Due to popular demand people want elf files that can be loaded to get debug symbols, so publish the elf file, but not the stub-less bin file. This elf file can ONLY be used to look up symbols, it should NOT be "load"ed into flash, because the preceding crc stub has to match. Mixing older crc stubs that are still in flash and newer elf files means the device will end up in DFU mode upon reset. Change-Id: Ifceb16d385388356ac1bf8b13f5df62c643bebf8 --- M contrib/prepare_upload.sh 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: laforge: Looks good to me, approved osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/contrib/prepare_upload.sh b/contrib/prepare_upload.sh index f134d2a..cdd144f 100755 --- a/contrib/prepare_upload.sh +++ b/contrib/prepare_upload.sh @@ -9,7 +9,7 @@ cd firmware/bin for ext in bin elf; do for file in *."$ext"; do - if ! [[ "$file" =~ ^(.*padded.*|.*nocrcstub.*)$ ]];then + if ! [[ "$file" =~ ^(.*padded.*|.*nocrcstub.*bin)$ ]];then without_ext="${file%.*}" cp -v "$file" "$without_ext-latest.$ext" cp -v "$file" "$without_ext-$GIT_VERSION.$ext" 2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/30153 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: Ifceb16d385388356ac1bf8b13f5df62c643bebf8 Gerrit-Change-Number: 30153 Gerrit-PatchSet: 4 Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-iuh[master]: asn1tostruct: don't use f-strings
by osmith 16 Nov '22

16 Nov '22
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/30177 ) Change subject: asn1tostruct: don't use f-strings ...................................................................... asn1tostruct: don't use f-strings Make the script work with python < 3.6 again by not using f-strings. Fix for: SyntaxError: invalid syntax File "../../git/asn1/utils/asn1tostruct.py", line 94 f" IE {ie}. Found another entry in ies {ie_other}" \ ^ Fixes: 1d19c8e2 ("asn1tostruct: fix defines getting redefined") Change-Id: I3a19b8a1147532b41d3ed7b802de595302ff8f44 --- M asn1/utils/asn1tostruct.py 1 file changed, 2 insertions(+), 2 deletions(-) Approvals: daniel: Looks good to me, but someone else must approve fixeria: Looks good to me, approved Jenkins Builder: Verified diff --git a/asn1/utils/asn1tostruct.py b/asn1/utils/asn1tostruct.py index d71d87d..9b1c1a1 100755 --- a/asn1/utils/asn1tostruct.py +++ b/asn1/utils/asn1tostruct.py @@ -91,8 +91,8 @@ if ie_other[2] == ie[2]: unique = False assert ie[0] != ie_other[0], "failed to find a unique name for" \ - f" IE {ie}. Found another entry in ies {ie_other}" \ - " that has the same ie[0] value." + " IE {}. Found another entry in ies {}" \ + " that has the same ie[0] value.".format(ie, ie_other) if unique: ret = ie[2] -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/30177 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I3a19b8a1147532b41d3ed7b802de595302ff8f44 Gerrit-Change-Number: 30177 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in osmo-iuh[master]: asn1tostruct: don't use f-strings
by fixeria 16 Nov '22

16 Nov '22
Attention is currently required from: osmith. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/30177 ) Change subject: asn1tostruct: don't use f-strings ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/30177 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I3a19b8a1147532b41d3ed7b802de595302ff8f44 Gerrit-Change-Number: 30177 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Wed, 16 Nov 2022 10:29:25 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • ...
  • 251
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.