fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35640?usp=email )
Change subject: mobile: handle V.24 line status updates from V.110 TA ......................................................................
mobile: handle V.24 line status updates from V.110 TA
Change-Id: I05ba2e10fefe3cae687831b5ced971aa244ad336 Related: OS#4396 --- M src/host/layer23/src/mobile/tch_data.c 1 file changed, 35 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/40/35640/1
diff --git a/src/host/layer23/src/mobile/tch_data.c b/src/host/layer23/src/mobile/tch_data.c index 6ee89dc..920fd38 100644 --- a/src/host/layer23/src/mobile/tch_data.c +++ b/src/host/layer23/src/mobile/tch_data.c @@ -187,11 +187,34 @@ osmo_soft_uart_tx_ubits(state->suart, buf, buf_size); }
+static const struct tch_v110_circuit_map_item { + enum osmo_v110_ta_circuit c; + enum osmo_soft_uart_status s; +} tch_v110_circuit_map[] = { + { OSMO_V110_TA_C_106, OSMO_SUART_STATUS_F_CTS }, + { OSMO_V110_TA_C_107, OSMO_SUART_STATUS_F_DSR }, + { OSMO_V110_TA_C_109, OSMO_SUART_STATUS_F_DCD }, +}; + static void tch_v110_ta_status_update_cb(void *priv, unsigned int status) { - LOGP(DL1C, LOGL_DEBUG, "%s(): [status=0x%08x]\n", __func__, status); + const struct tch_data_state *state = (struct tch_data_state *)priv;
- /* TODO: update status lines of the soft-UART (if state.suart != NULL) */ + LOGP(DL1C, LOGL_DEBUG, "V.110 TA status mask=0x%08x\n", status); + + for (unsigned int i = 0; i < ARRAY_SIZE(tch_v110_circuit_map); i++) { + const struct tch_v110_circuit_map_item *item = &tch_v110_circuit_map[i]; + bool is_on = (status & (1 << item->c)) != 0; + + LOGP(DL1C, LOGL_NOTICE, "V.110 TA circuit %s (%s) is %s\n", + osmo_v110_ta_circuit_name(item->c), + osmo_v110_ta_circuit_desc(item->c), + is_on ? "ON" : "OFF"); + + /* update status lines of the soft-UART */ + if (state->suart != NULL) + osmo_soft_uart_set_status_line(state->suart, item->s, is_on); + } }
struct osmo_v110_ta *tch_v110_ta_alloc(struct osmocom_ms *ms,