From e42e5a078926c63523235bdd8b0e84371effd592 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 8 Oct 2020 03:35:38 +0700 Subject: layer23/cbch-sniff: fix: use Osmocom specific RSL channel number This way the layer1 can activate proper CBCH task and send us CBCH block with proper RSL channel number, so they do not end up being routed to LAPDm and rejected there. Change-Id: Ib1d5c99587202a9d94aeb7b63de7ae8c4fb15af0 --- src/host/layer23/src/misc/app_cbch_sniff.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/host/layer23/src/misc/app_cbch_sniff.c b/src/host/layer23/src/misc/app_cbch_sniff.c index 58b33241..ed85cefe 100644 --- a/src/host/layer23/src/misc/app_cbch_sniff.c +++ b/src/host/layer23/src/misc/app_cbch_sniff.c @@ -34,6 +34,8 @@ #include #include +#include + #include struct osmocom_ms *g_ms; @@ -41,6 +43,8 @@ struct gsm48_sysinfo g_sysinfo = {}; static int try_cbch(struct osmocom_ms *ms, struct gsm48_sysinfo *s) { + uint8_t chan_nr; + if (!s->si1 || !s->si4) return 0; if (!s->chan_nr) { @@ -48,6 +52,13 @@ static int try_cbch(struct osmocom_ms *ms, struct gsm48_sysinfo *s) return 0; } + /* Convert received channel number to Osmocom specific one; + * this way the layer1 can activate proper CBCH task. */ + if (s->chan_nr != RSL_CHAN_SDCCH4_ACCH) + chan_nr = RSL_CHAN_OSMO_CBCH8 | (s->chan_nr & 0x07); + else + chan_nr = RSL_CHAN_OSMO_CBCH4; + if (s->h) { LOGP(DRR, LOGL_INFO, "chan_nr = 0x%02x TSC = %d MAIO = %d " "HSN = %d hseq (%d): %s\n", @@ -56,13 +67,13 @@ static int try_cbch(struct osmocom_ms *ms, struct gsm48_sysinfo *s) osmo_hexdump((unsigned char *) s->hopping, s->hopp_len * 2)); return l1ctl_tx_dm_est_req_h1(ms, s->maio, s->hsn, s->hopping, s->hopp_len, - s->chan_nr, s->tsc, + chan_nr, s->tsc, GSM48_CMODE_SIGN, 0); } else { LOGP(DRR, LOGL_INFO, "chan_nr = 0x%02x TSC = %d ARFCN = %d\n", s->chan_nr, s->tsc, s->arfcn); return l1ctl_tx_dm_est_req_h0(ms, s->arfcn, - s->chan_nr, s->tsc, GSM48_CMODE_SIGN, 0); + chan_nr, s->tsc, GSM48_CMODE_SIGN, 0); } } -- cgit v1.2.3