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 -----
  • December
  • 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

  • 1 participants
  • 97208 discussions
Change in osmo-iuh[master]: ranap_common_cn: add functions for direct access to decoder
by dexter 28 Jan '22

28 Jan '22
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/27002 ) Change subject: ranap_common_cn: add functions for direct access to decoder ...................................................................... ranap_common_cn: add functions for direct access to decoder The message encoder functions that decode a message to a struct ranap_message are only accessible via a callback function that is passed to ranap_cn_rx_cx The decoded ranap_message only lives inside the callback since it is freed by ranap_cn_rx_cx when the callback is done. In some situations this might make using the decoder incredibly difficult since it is not possible to keep the decoding results for an extended amount of time. Lets put the decoding into a separate function and use this function in ranap_cn_rx_cx. Then lets make the decoder and the free function public so that the decoder can be used in a more open way. Change-Id: I14d2ed8e597a5d12024a6a6c72ff011dbeb2549d Related: OS#5152 --- M include/osmocom/ranap/ranap_common_cn.h M src/ranap_common_cn.c 2 files changed, 58 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/02/27002/1 diff --git a/include/osmocom/ranap/ranap_common_cn.h b/include/osmocom/ranap/ranap_common_cn.h index dfce358..90ff6da 100644 --- a/include/osmocom/ranap/ranap_common_cn.h +++ b/include/osmocom/ranap/ranap_common_cn.h @@ -7,8 +7,20 @@ typedef void (*ranap_handle_cb)(void *ctx, ranap_message *ranap_msg); +/* free a decoded connection-less RANAP message */ +void ranap_cn_rx_cl_free(ranap_message *message); + +/* decode a connection-less RANAP message */ +int ranap_cn_rx_cl_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); + /* receive a connection-less RANAP message */ int ranap_cn_rx_cl(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); +/* free a decoded connection-oriented RANAP message */ +void ranap_cn_rx_co_free(ranap_message *message); + +/* decode a connection-oriented RANAP message */ +int ranap_cn_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len); + /* receive a connection-oriented RANAP message */ int ranap_cn_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len); diff --git a/src/ranap_common_cn.c b/src/ranap_common_cn.c index 03ce9ea..e7b8339 100644 --- a/src/ranap_common_cn.c +++ b/src/ranap_common_cn.c @@ -257,7 +257,8 @@ return rc; } -static void _cn_ranap_free_co(ranap_message *message) +/* free a decoded connection-oriented RANAP message */ +void ranap_cn_rx_co_free(ranap_message *message) { switch (message->direction) { case RANAP_RANAP_PDU_PR_initiatingMessage: @@ -281,27 +282,38 @@ } } -/* receive a connection-oriented RANAP message and call - * cn_ranap_handle_co() with the resulting ranap_message struct */ -int ranap_cn_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +/* decode a connection-oriented RANAP message */ +int ranap_cn_rx_co_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) { RANAP_RANAP_PDU_t *pdu = NULL; - ranap_message message; asn_dec_rval_t dec_ret; int rc; - memset(&message, 0, sizeof(message)); + memset(message, 0, sizeof(*message)); - dec_ret = aper_decode(NULL,&asn_DEF_RANAP_RANAP_PDU, (void **) &pdu, - data, len, 0, 0); + dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&pdu, data, len, 0, 0); if (dec_ret.code != RC_OK) { LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n"); return -1; } - message.direction = pdu->present; + message->direction = pdu->present; - rc = _cn_ranap_rx_co(ctx, pdu, &message); + rc = _cn_ranap_rx_co(ctx, pdu, message); + + ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + + return rc; +} + +/* receive a connection-oriented RANAP message and call + * cn_ranap_handle_co() with the resulting ranap_message struct */ +int ranap_cn_rx_co(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +{ + ranap_message message; + int rc; + + rc = ranap_cn_rx_co_decode(ctx, &message, data, len); if (rc == 0) (*cb)(ctx, &message); @@ -309,9 +321,7 @@ LOGP(DRANAP, LOGL_ERROR, "Not calling cn_ranap_handle_co() due to rc=%d\n", rc); /* Free the asn1 structs in message */ - _cn_ranap_free_co(&message); - - ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + ranap_cn_rx_co_free(&message); return rc; } @@ -496,7 +506,8 @@ return rc; } -static void _cn_ranap_free_cl(ranap_message *message) +/* free a decoded connection-less RANAP message */ +void ranap_cn_rx_cl_free(ranap_message *message) { switch (message->direction) { case RANAP_RANAP_PDU_PR_initiatingMessage: @@ -516,27 +527,38 @@ } } -/* receive a connection-less RANAP message and call - * cn_ranap_handle_co() with the resulting ranap_message struct */ -int ranap_cn_rx_cl(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +/* decode a connection-less RANAP message */ +int ranap_cn_rx_cl_decode(void *ctx, ranap_message *message, uint8_t *data, size_t len) { RANAP_RANAP_PDU_t *pdu = NULL; - ranap_message message; asn_dec_rval_t dec_ret; int rc; - memset(&message, 0, sizeof(message)); + memset(message, 0, sizeof(*message)); - dec_ret = aper_decode(NULL,&asn_DEF_RANAP_RANAP_PDU, (void **) &pdu, - data, len, 0, 0); + dec_ret = aper_decode(NULL, &asn_DEF_RANAP_RANAP_PDU, (void **)&pdu, data, len, 0, 0); if (dec_ret.code != RC_OK) { LOGP(DRANAP, LOGL_ERROR, "Error in RANAP ASN.1 decode\n"); return -1; } - message.direction = pdu->present; + message->direction = pdu->present; - rc = _cn_ranap_rx_cl(ctx, pdu, &message); + rc = _cn_ranap_rx_cl(ctx, pdu, message); + + ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + + return rc; +} + +/* receive a connection-less RANAP message and call + * cn_ranap_handle_co() with the resulting ranap_message struct */ +int ranap_cn_rx_cl(ranap_handle_cb cb, void *ctx, uint8_t *data, size_t len) +{ + ranap_message message; + int rc; + + rc = ranap_cn_rx_cl_decode(ctx, &message, data, len); if (rc == 0) (*cb)(ctx, &message); @@ -544,9 +566,7 @@ LOGP(DRANAP, LOGL_ERROR, "Not calling cn_ranap_handle_cl() due to rc=%d\n", rc); /* Free the asn1 structs in message */ - _cn_ranap_free_cl(&message); - - ASN_STRUCT_FREE(asn_DEF_RANAP_RANAP_PDU, pdu); + ranap_cn_rx_cl_free(&message); return rc; } -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/27002 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: I14d2ed8e597a5d12024a6a6c72ff011dbeb2549d Gerrit-Change-Number: 27002 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-iuh[master]: ranap_common_ran: add decoder for RAN/RNC originated messages
by dexter 28 Jan '22

28 Jan '22
Attention is currently required from: laforge, dexter. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 to look at the new patch set (#5). Change subject: ranap_common_ran: add decoder for RAN/RNC originated messages ...................................................................... ranap_common_ran: add decoder for RAN/RNC originated messages Lets add a counterpart for ranap_common_cn that works the same, but decodes RAN/RNC originated messages. Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Related: OS#5152 --- M include/osmocom/ranap/Makefile.am M include/osmocom/ranap/ranap_common.h M include/osmocom/ranap/ranap_common_cn.h A include/osmocom/ranap/ranap_common_ran.h M src/Makefile.am A src/ranap_common_ran.c 6 files changed, 204 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/55/26955/5 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Gerrit-Change-Number: 26955 Gerrit-PatchSet: 5 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-iuh[master]: ranap_common_ran: add decoder for RAN/RNC originated messages
by dexter 27 Jan '22

27 Jan '22
Attention is currently required from: laforge, dexter. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 to look at the new patch set (#4). Change subject: ranap_common_ran: add decoder for RAN/RNC originated messages ...................................................................... ranap_common_ran: add decoder for RAN/RNC originated messages Lets add a counterpart for ranap_common_cn that works the same, but decodes RAN/RNC originated messages. Related: OS#515 Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 --- M include/osmocom/ranap/Makefile.am M include/osmocom/ranap/ranap_common.h M include/osmocom/ranap/ranap_common_cn.h A include/osmocom/ranap/ranap_common_ran.h M src/Makefile.am A src/ranap_common_ran.c 6 files changed, 187 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/55/26955/4 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Gerrit-Change-Number: 26955 Gerrit-PatchSet: 4 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-iuh[master]: ranap_common_ran: add decoder for RAN/RNC originated messages
by dexter 27 Jan '22

27 Jan '22
Attention is currently required from: laforge, dexter. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 to look at the new patch set (#3). Change subject: ranap_common_ran: add decoder for RAN/RNC originated messages ...................................................................... ranap_common_ran: add decoder for RAN/RNC originated messages Lets add a counterpart for ranap_common_cn that works the same, but decodes RAN/RNC originated messages. Related: OS#515 Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 --- M include/osmocom/ranap/Makefile.am M include/osmocom/ranap/ranap_common.h M include/osmocom/ranap/ranap_common_cn.h A include/osmocom/ranap/ranap_common_ran.h M src/Makefile.am A src/ranap_common_ran.c 6 files changed, 283 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/55/26955/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Gerrit-Change-Number: 26955 Gerrit-PatchSet: 3 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-iuh[master]: ranap_common_ran: add decoder for RAN/RNC originated messages
by dexter 27 Jan '22

27 Jan '22
Attention is currently required from: laforge. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 to look at the new patch set (#2). Change subject: ranap_common_ran: add decoder for RAN/RNC originated messages ...................................................................... ranap_common_ran: add decoder for RAN/RNC originated messages Lets add a counterpart for ranap_common_cn that works the same, but decodes RAN/RNC originated messages. Related: OS#515 Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 --- M include/osmocom/ranap/Makefile.am M include/osmocom/ranap/ranap_common.h M include/osmocom/ranap/ranap_common_cn.h A include/osmocom/ranap/ranap_common_ran.h M src/Makefile.am A src/ranap_common_ran.c 6 files changed, 283 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/55/26955/2 -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Gerrit-Change-Number: 26955 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-iuh[master]: ranap_common_ran: add decoder for RAN/RNC originated messages
by dexter 27 Jan '22

27 Jan '22
Attention is currently required from: laforge. dexter has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-iuh/+/26955 ) Change subject: ranap_common_ran: add decoder for RAN/RNC originated messages ...................................................................... Patch Set 2: (1 comment) File src/ranap_common_ran.c: https://gerrit.osmocom.org/c/osmo-iuh/+/26955/comment/51a90d1d_c5776867 PS1, Line 3: / > I didn't write this, right? I guess it should be (C) sysmocom Author: pmaier Done -- To view, visit https://gerrit.osmocom.org/c/osmo-iuh/+/26955 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Change-Id: Iad4c2743d4d1ddf8ad49002d1fe6866f22eb9e98 Gerrit-Change-Number: 26955 Gerrit-PatchSet: 2 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Thu, 27 Jan 2022 15:19:15 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Gerrit-MessageType: comment
1 0
0 0
Change in docker-playground[master]: osmo-uecups-master/Dockerfile: do not pass command line options
by fixeria 26 Jan '22

26 Jan '22
Attention is currently required from: laforge. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/26982 ) Change subject: osmo-uecups-master/Dockerfile: do not pass command line options ...................................................................... Patch Set 2: (1 comment) Patchset: PS1: > spelling: command liNe, not liKe (in script and commit message) Done. -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/26982 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ia9b220e4cfbc89b800fafdd153bd63d6d95799e2 Gerrit-Change-Number: 26982 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: laforge <laforge(a)osmocom.org> Gerrit-Comment-Date: Wed, 26 Jan 2022 19:08:57 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: laforge <laforge(a)osmocom.org> Gerrit-MessageType: comment
1 0
0 0
Change in docker-playground[master]: osmo-uecups-master/Dockerfile: do not pass command line options
by fixeria 26 Jan '22

26 Jan '22
Attention is currently required from: fixeria. fixeria has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/docker-playground/+/26982 ) Change subject: osmo-uecups-master/Dockerfile: do not pass command line options ...................................................................... osmo-uecups-master/Dockerfile: do not pass command line options Change-Id: Ia9b220e4cfbc89b800fafdd153bd63d6d95799e2 Related: SYS#5602 --- M osmo-uecups-master/Dockerfile 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/82/26982/2 -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/26982 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: Ia9b220e4cfbc89b800fafdd153bd63d6d95799e2 Gerrit-Change-Number: 26982 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: laforge <laforge(a)osmocom.org> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in simtrace2[master]: simtrace2-cardem-pcsc: Detect card power-up without RESET
by laforge 26 Jan '22

26 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/27001 ) Change subject: simtrace2-cardem-pcsc: Detect card power-up without RESET ...................................................................... simtrace2-cardem-pcsc: Detect card power-up without RESET In some readers (at least CardMan 3121), the simtrace2-cardem firmware claims there are power-up sequences where RESET is released before VCC becomes active. Let's detect such spec-incompliant power-up sequences and use them to trigger a cold reset of the card. Change-Id: I682ac3d0c2b98749a6ed44f9a73e4b39354a4284 Closes: OS#5421 --- M host/src/simtrace2-cardem-pcsc.c 1 file changed, 23 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/01/27001/1 diff --git a/host/src/simtrace2-cardem-pcsc.c b/host/src/simtrace2-cardem-pcsc.c index 807df72..c684868 100644 --- a/host/src/simtrace2-cardem-pcsc.c +++ b/host/src/simtrace2-cardem-pcsc.c @@ -74,22 +74,40 @@ static uint32_t last_status_flags = 0; +#define NO_RESET 0 +#define COLD_RESET 1 +#define WARM_RESET 2 + static void update_status_flags(struct osmo_st2_cardem_inst *ci, uint32_t flags) { struct osim_card_hdl *card = ci->chan->card; + int reset = NO_RESET; + /* check if card is _now_ operational: VCC+CLK present, RST absent */ if ((flags & CEMU_STATUS_F_VCC_PRESENT) && (flags & CEMU_STATUS_F_CLK_ACTIVE) && !(flags & CEMU_STATUS_F_RESET_ACTIVE)) { if (last_status_flags & CEMU_STATUS_F_RESET_ACTIVE) { /* a reset has just ended, forward it to the real card */ - bool cold_reset = true; if (last_status_flags & CEMU_STATUS_F_VCC_PRESENT) - cold_reset = false; - LOGCI(ci, LOGL_NOTICE, "%s Resetting card in reader...\n", - cold_reset ? "Cold" : "Warm"); - osim_card_reset(card, cold_reset); + reset = WARM_RESET; + else + reset = COLD_RESET; + } else if (!(last_status_flags & CEMU_STATUS_F_VCC_PRESENT)) { + /* power-up has just happened, perform cold reset */ + reset = COLD_RESET; } + } else if (flags == CEMU_STATUS_F_VCC_PRESENT && + !(last_status_flags & CEMU_STATUS_F_VCC_PRESENT)) { + /* improper power-up: Only power enabled, but no reset active. */ + reset = COLD_RESET; } + + if (reset) { + LOGCI(ci, LOGL_NOTICE, "%s Resetting card in reader...\n", + reset == COLD_RESET ? "Cold" : "Warm"); + osim_card_reset(card, reset == COLD_RESET ? true : false); + } + last_status_flags = flags; } -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/27001 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I682ac3d0c2b98749a6ed44f9a73e4b39354a4284 Gerrit-Change-Number: 27001 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
Change in simtrace2[master]: simtrace2-cardem-pcsc: Move all logging into libosmocore
by laforge 26 Jan '22

26 Jan '22
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/27000 ) Change subject: simtrace2-cardem-pcsc: Move all logging into libosmocore ...................................................................... simtrace2-cardem-pcsc: Move all logging into libosmocore * drop log statements that are already in libosmo-simtrace2 * don't printf directly, but go via LOGCI * make LOGCI use libosmocore logging * configure libosmocore logging in a 'convenient' way Change-Id: I6fa0da966e6d8e723c187404c17e90cfb3f3dd9f --- M host/src/simtrace2-cardem-pcsc.c 1 file changed, 26 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/00/27000/1 diff --git a/host/src/simtrace2-cardem-pcsc.c b/host/src/simtrace2-cardem-pcsc.c index 19ed94e..807df72 100644 --- a/host/src/simtrace2-cardem-pcsc.c +++ b/host/src/simtrace2-cardem-pcsc.c @@ -1,7 +1,7 @@ /* simtrace2-cardem-pcsc - main program for the host PC to provide a remote SIM * using the SIMtrace 2 firmware in card emulation mode * - * (C) 2016-2021 by Harald Welte <hwelte(a)hmw-consulting.de> + * (C) 2016-2022 by Harald Welte <hwelte(a)hmw-consulting.de> * (C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon(a)sysmocom.de> * * This program is free software; you can redistribute it and/or @@ -49,7 +49,7 @@ #include <osmocom/sim/class_tables.h> #include <osmocom/sim/sim.h> -#define LOGCI(ci, lvl, fmt, args ...) printf(fmt, ## args) +#define LOGCI(ci, lvl, fmt, args ...) LOGP(DLGLOBAL, lvl, fmt, ## args) static void atr_update_csum(uint8_t *atr, unsigned int atr_len) { @@ -93,6 +93,17 @@ last_status_flags = flags; } +static const char *cemu_data_flags2str(uint32_t flags) +{ + static char out[64]; + snprintf(out, sizeof(out), "%s%s%s%s", + flags & CEMU_DATA_F_TPDU_HDR ? "HDR " : "", + flags & CEMU_DATA_F_FINAL ? "FINAL " : "", + flags & CEMU_DATA_F_PB_AND_TX ? "PB_AND_TX " : "", + flags & CEMU_DATA_F_PB_AND_RX ? "PB_AND_RX" : ""); + return out; +} + /*********************************************************************** * Incoming Messages ***********************************************************************/ @@ -104,7 +115,7 @@ char fbuf[80]; cemu_status_flags2str(fbuf, sizeof(fbuf), status->flags); - printf("=> STATUS: flags=0x%x, fi=%u, di=%u, wi=%u wtime=%u (%s)\n", + LOGCI(ci, LOGL_NOTICE, "=> STATUS: flags=0x%x, fi=%u, di=%u, wi=%u wtime=%u (%s)\n", status->flags, status->fi, status->di, status->wi, status->waiting_time, fbuf); @@ -119,7 +130,7 @@ struct cardemu_usb_msg_pts_info *pts; pts = (struct cardemu_usb_msg_pts_info *) buf; - printf("=> PTS req: %s\n", osmo_hexdump(pts->req, sizeof(pts->req))); + LOGCI(ci, LOGL_NOTICE, "=> PTS req: %s\n", osmo_hexdump(pts->req, pts->pts_len)); return 0; } @@ -133,8 +144,8 @@ data = (struct cardemu_usb_msg_rx_data *) buf; - printf("=> DATA: flags=%x, %s: ", data->flags, - osmo_hexdump(data->data, data->data_len)); + LOGCI(ci, LOGL_INFO, "=> DATA: flags=0x%02x (%s), %s\n ", data->flags, + cemu_data_flags2str(data->flags), osmo_hexdump(data->data, data->data_len)); rc = osmo_apdu_segment_in(&ac, data->data, data->data_len, data->flags & CEMU_DATA_F_TPDU_HDR); @@ -163,7 +174,6 @@ msgb_apdu_sw(tmsg) = msgb_get_u16(tmsg); ac.sw[0] = msgb_apdu_sw(tmsg) >> 8; ac.sw[1] = msgb_apdu_sw(tmsg) & 0xff; - printf("SW=0x%04x, len_rx=%d\n", msgb_apdu_sw(tmsg), msgb_l3len(tmsg)); if (msgb_l3len(tmsg)) osmo_st2_cardem_request_pb_and_tx(ci, ac.hdr.ins, tmsg->l3h, msgb_l3len(tmsg)); osmo_st2_cardem_request_sw_tx(ci, ac.sw); @@ -179,8 +189,6 @@ struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *)buf; int rc; - printf("-> %s\n", osmo_hexdump(buf, len)); - buf += sizeof(*sh); switch (sh->msg_type) { @@ -213,7 +221,7 @@ char fbuf[80]; cemu_status_flags2str(fbuf, sizeof(fbuf), status->flags); - LOGCI(ci, LOGL_INFO, "=> IRQ STATUS: flags=0x%x, fi=%u, di=%u, wi=%u wtime=%u (%s)\n", + LOGCI(ci, LOGL_NOTICE, "=> IRQ STATUS: flags=0x%x, fi=%u, di=%u, wi=%u wtime=%u (%s)\n", status->flags, status->fi, status->di, status->wi, status->waiting_time, fbuf); @@ -227,8 +235,6 @@ struct simtrace_msg_hdr *sh = (struct simtrace_msg_hdr *)buf; int rc; - LOGCI(ci, LOGL_INFO, "SIMtrace IRQ %s\n", osmo_hexdump(buf, len)); - buf += sizeof(*sh); switch (sh->msg_type) { @@ -351,7 +357,7 @@ static void print_welcome(void) { printf("simtrace2-cardem-pcsc - Using PC/SC reader as SIM\n" - "(C) 2010-2020, Harald Welte <laforge(a)gnumonks.org>\n" + "(C) 2010-2022, Harald Welte <laforge(a)gnumonks.org>\n" "(C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon(a)sysmocom.de>\n\n"); } @@ -454,6 +460,13 @@ } osmo_init_logging2(NULL, &log_info); + log_set_print_category_hex(osmo_stderr_target, false); + log_set_print_category(osmo_stderr_target, true); + log_set_print_level(osmo_stderr_target, true); + log_set_print_filename_pos(osmo_stderr_target, LOG_FILENAME_POS_LINE_END); + log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE); + log_set_category_filter(osmo_stderr_target, DLINP, 1, LOGL_DEBUG); + log_set_category_filter(osmo_stderr_target, DLGLOBAL, 1, LOGL_DEBUG); while (1) { int option_index = 0; -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/27000 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I6fa0da966e6d8e723c187404c17e90cfb3f3dd9f Gerrit-Change-Number: 27000 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge(a)osmocom.org> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 9659
  • 9660
  • 9661
  • 9662
  • 9663
  • 9664
  • 9665
  • ...
  • 9721
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.