fixeria submitted this change.

View Change

Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved
Revert "host/trxcon/trx_ic.c: use osmo_ubit2sbit() from libosmocore"

This reverts commit c5d9507b5ddd04d4ac14dc009b6df20c3098e2cc.

Using osmo_ubit2sbit() was a bad idea because this function treats
the input buffer as ubits (while we deal with usbits) and produces
absolute sbit values: either 127 or -127. This is wrong, because
all intermediate usbit values are getting converted to -127.

This bug remained unnoticed so far because trxcon is mostly used in
combination with fake_trx.py, a virtual Um interface which simulates
ideal RF conditions by default and feeds trxcon with 'perfect' bits.

Change-Id: I3a32da19c9f419d51d55b301461ce28ce11b2249
---
M src/host/trxcon/src/trx_if.c
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c
index 7b1ca99..6f225ee 100644
--- a/src/host/trxcon/src/trx_if.c
+++ b/src/host/trxcon/src/trx_if.c
@@ -621,7 +621,12 @@
toa256 = ((int16_t) (buf[6] << 8) | buf[7]);

/* Copy and convert bits {254..0} to sbits {-127..127} */
- osmo_ubit2sbit(bits, buf + 8, 148);
+ for (unsigned int i = 0; i < 148; i++) {
+ if (buf[8 + i] == 255)
+ bits[i] = -127;
+ else
+ bits[i] = 127 - buf[8 + i];
+ }

if (tn >= 8) {
LOGPFSMSL(trx->fi, DTRXD, LOGL_ERROR, "Illegal TS %d\n", tn);

2 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one.

To view, visit change 29852. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I3a32da19c9f419d51d55b301461ce28ce11b2249
Gerrit-Change-Number: 29852
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged