diff --git a/src/Makefile b/src/Makefile index cf325e6..08a5f7e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ CPPFLAGS ?= -g -O0 -Wall `pkg-config --cflags libosmocore` `pkg-config --cflags LIBS ?= `pkg-config --libs libosmocore` `pkg-config --libs qmi-glib` all: osmo-qcdiag-log -MODS_LOG = gprs_rlc.o gprs_mac.o diag_gsm.o diag_log.o diag_log_gsm.o diag_log_gprs.o diag_log_wcdma.o diag_log_umts.o diag_log_qmi.o diag_dpl.o +MODS_LOG = gprs_rlc.o gprs_mac.o diag_gsm.o diag_log.o diag_log_gsm.o diag_log_gprs.o diag_log_wcdma.o diag_log_umts.o diag_log_qmi.o diag_dpl.o diag_log_simcard.o osmo-qcdiag-log: diagchar_hdlc.o diag_io.o osmo-qcdiag-log.o diag_msg.o protocol.o diag_cmd.o $(MODS_LOG) $(CC) $(CPPFLAGS) -o $@ $^ $(LIBS) diff --git a/src/diag_log_simcard.c b/src/diag_log_simcard.c new file mode 100644 index 0000000..1365df1 --- /dev/null +++ b/src/diag_log_simcard.c @@ -0,0 +1,50 @@ +/* Utility code for DIAG UIM (Simcard) Logging */ +/* + * (C) 2016 by Harald Welte + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include + +#include "diag_log.h" +#include "diag_io.h" +#include "protocol/diagcmd.h" +#include "protocol/diag_log_1x.h" + +static void handle_uim_data(struct log_hdr *lh, struct msgb *msg) +{ + struct diag_log_uim_msg *uim = (struct diag_log_uim_msg *) msgb_data(msg); + printf("UIM_DATA { %s }\n", msgb_hexdump(msg)); +} + +static void handle_uim_ds_data(struct log_hdr *lh, struct msgb *msg) +{ + printf("UIM_DS_DATA {}\n"); +} + + +static const struct diag_log_dispatch_tbl log_tbl[] = { + { L1X(LOG_UIM_DATA_C), handle_uim_data }, + { L1X(LOG_UIM_DS_DATA_C), handle_uim_ds_data }, +}; + +static __attribute__((constructor)) void on_dso_load_gsm(void) +{ + diag_log_reg_dispatch(log_tbl, ARRAY_SIZE(log_tbl)); +} diff --git a/src/protocol/diag_log_1x.h b/src/protocol/diag_log_1x.h index fc446e0..4442d6a 100644 --- a/src/protocol/diag_log_1x.h +++ b/src/protocol/diag_log_1x.h @@ -6,6 +6,7 @@ enum diag_log_code_1x { LOG_UIM_DATA_C = 0x98, + LOG_UIM_DS_DATA_C = 0x4ce, LOG_DATA_PROTOCOL_LOGGING_C = 0x1eb, LOG_DATA_PROTOCOL_LOGGING_NETWORK_IP_RM_TX_80_BYTES_C = 0x572, LOG_DATA_PROTOCOL_LOGGING_NETWORK_IP_RM_RX_80_BYTES_C = 0x573, @@ -28,3 +29,8 @@ enum diag_log_code_1x { LOG_DATA_PROTOCOL_LOGGING_FLOW_UM_TX_80_BYTES_C = 0x584, LOG_DATA_PROTOCOL_LOGGING_FLOW_UM_TX_FULL_C = 0x585, }; + +struct diag_log_uim_msg { + uint8_t len; + uint8_t data[0]; +} __attribute__ ((packed));