diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-12-06 21:23:37 +0700 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2023-12-06 22:26:47 +0700 |
commit | f07f12b8b05c7a24c715ab82c5b291ba2e8214e4 (patch) | |
tree | c0dcf9aa1484f1beed7120212f9aa7a9f2f4995f | |
parent | 3446b43d397c9a13cd64bf7534d81b41a9bd2aea (diff) |
layer23: hack ccch_scan to start PDCH sniffing immediately
-rw-r--r-- | src/host/layer23/configure.ac | 1 | ||||
-rw-r--r-- | src/host/layer23/src/misc/Makefile.am | 4 | ||||
-rw-r--r-- | src/host/layer23/src/misc/app_ccch_scan.c | 29 |
3 files changed, 29 insertions, 5 deletions
diff --git a/src/host/layer23/configure.ac b/src/host/layer23/configure.ac index 34dcbff6..24653539 100644 --- a/src/host/layer23/configure.ac +++ b/src/host/layer23/configure.ac @@ -43,6 +43,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.10.0) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm) PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec) +PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding) AC_CHECK_LIB(gps, gps_waiting, LIBGPS_CFLAGS=" -D_HAVE_GPSD" LIBGPS_LIBS=" -lgps ",,) AC_SUBST([LIBGPS_CFLAGS]) AC_SUBST([LIBGPS_LIBS]) diff --git a/src/host/layer23/src/misc/Makefile.am b/src/host/layer23/src/misc/Makefile.am index 1daa39d0..ce7b41ce 100644 --- a/src/host/layer23/src/misc/Makefile.am +++ b/src/host/layer23/src/misc/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBGPS_CFLAGS) -LDADD = ../common/liblayer23.a $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBGPS_LIBS) +AM_CFLAGS = -Wall $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODING_CFLAGS) $(LIBGPS_CFLAGS) +LDADD = ../common/liblayer23.a $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOCODING_LIBS) $(LIBGPS_LIBS) bin_PROGRAMS = bcch_scan ccch_scan echo_test cell_log cbch_sniff diff --git a/src/host/layer23/src/misc/app_ccch_scan.c b/src/host/layer23/src/misc/app_ccch_scan.c index 3091a4b0..dffdd641 100644 --- a/src/host/layer23/src/misc/app_ccch_scan.c +++ b/src/host/layer23/src/misc/app_ccch_scan.c @@ -36,6 +36,9 @@ #include <osmocom/core/bits.h> #include <osmocom/gsm/a5.h> +#include <osmocom/gsm/protocol/gsm_08_58.h> +#include <osmocom/coding/gsm0503_coding.h> + #include <osmocom/bb/common/logging.h> #include <osmocom/bb/misc/rslms.h> #include <osmocom/bb/misc/layer3.h> @@ -516,9 +519,11 @@ int gsm48_rx_ccch(struct msgb *msg, struct osmocom_ms *ms) case GSM48_MT_RR_PAG_REQ_3: gsm48_rx_paging_p3(msg, ms); break; +#if 0 case GSM48_MT_RR_IMM_ASS: gsm48_rx_imm_ass(msg, ms); break; +#endif case GSM48_MT_RR_NOTIF_NCH: /* notification for voice call groups and such */ break; @@ -532,6 +537,17 @@ int gsm48_rx_ccch(struct msgb *msg, struct osmocom_ms *ms) rc = -EINVAL; } + /* XXX: tune to a PDCH with hard-coded timeslot number */ + const uint8_t chan_nr = RSL_CHAN_OSMO_PDCH | 7; /* FIXME: timeslot number */ + const uint8_t tsc = 3; /* FIXME: check 'base_station_id_code' in osmo-bsc.cfg */ + + l1ctl_tx_dm_est_req_h0(ms, + ms->test_arfcn, /* argv: -a ARFCN */ + chan_nr, tsc, GSM48_CMODE_SIGN, 0); + app_state.dch_state = DCH_WAIT_EST; + app_state.dch_nr = chan_nr; + app_state.dch_badcnt = 0; + return rc; } @@ -593,6 +609,9 @@ local_burst_decode(struct l1ctl_burst_ind *bi) } else if ((cbits & 0x18) == 0x08) { /* SDCCH/8 */ lch_idx = cbits & 7; bid = bi->flags & 3; + } else if (cbits == ABIS_RSL_CHAN_NR_CBITS_OSMO_PDCH) { /* PDCH */ + lch_idx = 0; + bid = bi->flags & 3; } if (bid == -1) @@ -622,11 +641,15 @@ local_burst_decode(struct l1ctl_burst_ind *bi) /* If last, decode */ if (bid == 3) { - uint8_t l2[23]; + int n_errors = 0, n_bits_total = 0; + uint8_t l2[64]; int rv; - rv = xcch_decode(l2, bursts); - if (rv == 0) + rv = gsm0503_pdtch_decode(l2, bursts, NULL, &n_errors, &n_bits_total); + fprintf(stderr, "%s(): gsm0503_pdtch_decode(): len=%d, BER=%d/%d\n", + __func__, rv, n_errors, n_bits_total); + + if (rv > 0) { uint8_t chan_type, chan_ts, chan_ss; uint8_t gsmtap_chan_type; |