diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-07-25 22:16:11 +0700 |
---|---|---|
committer | fixeria <vyanitskiy@sysmocom.de> | 2022-07-29 12:32:11 +0000 |
commit | 40d66990e01ffeab58193ffbcca1b18952c74949 (patch) | |
tree | 821d08c2ec08e734f71edc8556b6509f223fc9bb | |
parent | 38c4f7294bfb9e5ecb7076cb0d96a6b8fc5dd83a (diff) |
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
-rw-r--r-- | src/host/trxcon/src/trx_if.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/host/trxcon/src/trx_if.c b/src/host/trxcon/src/trx_if.c index a9a6c96f..92b9d12c 100644 --- a/src/host/trxcon/src/trx_if.c +++ b/src/host/trxcon/src/trx_if.c @@ -768,6 +768,8 @@ void trx_if_flush_ctrl(struct trx_instance *trx) 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 @@ void trx_if_close(struct trx_instance *trx) /* 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); |