fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/28794 )
Change subject: trxcon: trx_if_close(): power the transceiver off if needed ......................................................................
trxcon: trx_if_close(): power the transceiver off if needed
Currently it may happen that the transceiver (e.g. fake_trx.py) remains powered on when we loose a L1CTL client connection. This is going to be fixed in change [1] re-implementing the trxcon_fsm. For now let's ensure that the transceiver is properly powered off by sending "CMD POWEROFF" from trx_if_close().
Change-Id: I9c5178907304b36ec3de0ee31b7f7a9ed2e31c16 Related: [1] Ifaf63ead9dd180181358e771367b2a686ba159ca --- M src/host/trxcon/src/trx_if.c 1 file changed, 6 insertions(+), 0 deletions(-)
Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c index a9a6c96..92b9d12 100644 --- a/src/host/trxcon/src/trx_if.c +++ b/src/host/trxcon/src/trx_if.c @@ -768,6 +768,8 @@
void trx_if_close(struct trx_instance *trx) { + static const char cmd_poweroff[] = "CMD POWEROFF"; + /* May be unallocated due to init error */ if (!trx) return; @@ -780,6 +782,10 @@ /* Flush CTRL message list */ trx_if_flush_ctrl(trx);
+ /* Power off if the transceiver is up */ + if (trx->powered_up && trx->trx_ofd_ctrl.fd >= 0) + send(trx->trx_ofd_ctrl.fd, &cmd_poweroff[0], sizeof(cmd_poweroff), 0); + /* Close sockets */ trx_udp_close(&trx->trx_ofd_ctrl); trx_udp_close(&trx->trx_ofd_data);