HACK to make CRC4 computation work
* reverse bit-order of every input byte when computing CRC4
* reverse bit-order of CRC4 value we receive in TS0 bits
I don't really understand why, but this makes the CRC check pass.
We probably need another table if we want to avoid this.
diff --git a/src/osmo_e1.c b/src/osmo_e1.c
index 5134965..f47e8ed 100644
--- a/src/osmo_e1.c
+++ b/src/osmo_e1.c
@@ -389,10 +389,10 @@
if (smf2)
offset = 8;
- crc |= (e1i->rx.ts0_history[0+offset] >> 7) << 3;
- crc |= (e1i->rx.ts0_history[2+offset] >> 7) << 2;
- crc |= (e1i->rx.ts0_history[4+offset] >> 7) << 1;
- crc |= (e1i->rx.ts0_history[6+offset] >> 7) << 0;
+ crc |= (e1i->rx.ts0_history[0+offset] >> 7) << 0;
+ crc |= (e1i->rx.ts0_history[2+offset] >> 7) << 1;
+ crc |= (e1i->rx.ts0_history[4+offset] >> 7) << 2;
+ crc |= (e1i->rx.ts0_history[6+offset] >> 7) << 3;
return crc;
}