From 0ed7c0ee5ffdf8e20824a73a0a3ce9f687c04341 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Wed, 27 May 2020 20:47:03 +0700 Subject: trxcon: fix l1ctl_proc_est_req_h0(): convert to host byte order L1CTL is using the network byte order, because this protocol is spoken between different devices and architectures. Somehow I forgot about this while adding SETFH command back in 2018. Change-Id: Ia2f70f0d5e35b6bf05e1fa6fb51a15c1bbe3ca4c Related: OS#4546 --- src/host/trxcon/l1ctl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/host/trxcon/l1ctl.c b/src/host/trxcon/l1ctl.c index e722624c..84e1ec6f 100644 --- a/src/host/trxcon/l1ctl.c +++ b/src/host/trxcon/l1ctl.c @@ -595,7 +595,8 @@ static int l1ctl_proc_est_req_h0(struct trx_instance *trx, struct l1ctl_h0 *h) static int l1ctl_proc_est_req_h1(struct trx_instance *trx, struct l1ctl_h1 *h) { - int rc; + uint16_t ma[64]; + int i, rc; LOGP(DL1C, LOGL_NOTICE, "L1CTL_DM_EST_REQ indicates a Frequency " "Hopping (hsn=%u, maio=%u, chans=%u) channel\n", @@ -607,8 +608,12 @@ static int l1ctl_proc_est_req_h1(struct trx_instance *trx, struct l1ctl_h1 *h) return -EINVAL; } + /* Convert from network to host byte order */ + for (i = 0; i < h->n; i++) + ma[i] = ntohs(h->ma[i]); + /* Forward hopping parameters to TRX */ - rc = trx_if_cmd_setfh(trx, h->hsn, h->maio, h->ma, h->n); + rc = trx_if_cmd_setfh(trx, h->hsn, h->maio, ma, h->n); if (rc) return rc; -- cgit v1.2.3