Change in osmocom-bb[master]: mobile: add audio config, with unused audio loopback setting

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Tue Mar 24 15:41:17 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/17593 )


Change subject: mobile: add audio config, with unused audio loopback setting
......................................................................

mobile: add audio config, with unused audio loopback setting

The aim is to add configurable audio loopback to mobile. An existing patch on a
branch from fixeria [1] adds the audio config section. Add a reduced version of
this audio config to be compatible with the future merge.

Add the audio loopback setting, so far without functionality.
Subsequent patch adds the actual loopback.

[1] osmocom-bb branch fixeria/audio,
    patch "mobile/vty_interface.c: add new 'audio' section"
    Change-id I62cd5ef22ca2290fcafe65c78537ddbcb39fb8c6

Change-Id: Ie03e4a6c6f81ea3925266dd22e87506d722a6e1a
---
M doc/examples/mobile/default.cfg
M doc/examples/mobile/multi_ms.cfg
M src/host/layer23/include/osmocom/bb/mobile/settings.h
M src/host/layer23/include/osmocom/bb/mobile/vty.h
M src/host/layer23/src/mobile/settings.c
M src/host/layer23/src/mobile/vty_interface.c
6 files changed, 93 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/93/17593/1

diff --git a/doc/examples/mobile/default.cfg b/doc/examples/mobile/default.cfg
index cc81630..596a580 100644
--- a/doc/examples/mobile/default.cfg
+++ b/doc/examples/mobile/default.cfg
@@ -59,4 +59,6 @@
   ki comp128 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   no barred-access
   rplmn 001 01
+ audio
+  io-target none
  no shutdown
diff --git a/doc/examples/mobile/multi_ms.cfg b/doc/examples/mobile/multi_ms.cfg
index bef2406..4735189 100644
--- a/doc/examples/mobile/multi_ms.cfg
+++ b/doc/examples/mobile/multi_ms.cfg
@@ -59,6 +59,8 @@
   ki comp128 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
   no barred-access
   rplmn 001 01
+ audio
+  io-target none
  no shutdown
 !
 ms two
@@ -109,4 +111,6 @@
   ki comp128 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
   no barred-access
   rplmn 001 01
+ audio
+  io-target none
  no shutdown
diff --git a/src/host/layer23/include/osmocom/bb/mobile/settings.h b/src/host/layer23/include/osmocom/bb/mobile/settings.h
index 4e5d5a1..f4682d4 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/settings.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/settings.h
@@ -3,10 +3,29 @@
 
 #define MOB_C7_DEFLT_ANY_TIMEOUT	30
 
+/* TCH frame I/O target */
+enum audio_io_target {
+	/* Nothing, don't care about TCH */
+	AUDIO_IO_NONE = 0,
+	/* Return to sender */
+	AUDIO_IO_LOOPBACK,
+};
+
+extern const struct value_string audio_io_target_names[];
+static inline const char *audio_io_target_name(enum audio_io_target val)
+{ return get_value_string(audio_io_target_names, val); }
+
+struct audio_settings {
+	enum audio_io_target io_target;
+};
+
 struct gsm_settings {
 	char			layer2_socket_path[128];
 	char			sap_socket_path[128];
 
+	/* Audio settings */
+	struct audio_settings	audio;
+
 	/* IMEI */
 	char			imei[16];
 	char			imeisv[17];
diff --git a/src/host/layer23/include/osmocom/bb/mobile/vty.h b/src/host/layer23/include/osmocom/bb/mobile/vty.h
index 3bec113..d066804 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/vty.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/vty.h
@@ -10,6 +10,7 @@
 	MS_NODE = _LAST_OSMOVTY_NODE + 1,
 	TESTSIM_NODE,
 	SUPPORT_NODE,
+	AUDIO_NODE,
 };
 
 int ms_vty_go_parent(struct vty *vty);
diff --git a/src/host/layer23/src/mobile/settings.c b/src/host/layer23/src/mobile/settings.c
index 388c754..1898bbd 100644
--- a/src/host/layer23/src/mobile/settings.c
+++ b/src/host/layer23/src/mobile/settings.c
@@ -41,6 +41,9 @@
 	strcpy(set->layer2_socket_path, layer2_socket_path);
 	strcpy(set->sap_socket_path, sap_socket_path);
 
+	/* Audio settings */
+	set->audio.io_target = AUDIO_IO_NONE;
+
 	/* network search */
 	set->plmn_mode = PLMN_MODE_AUTO;
 
diff --git a/src/host/layer23/src/mobile/vty_interface.c b/src/host/layer23/src/mobile/vty_interface.c
index 70ee703..fc9ec6f 100644
--- a/src/host/layer23/src/mobile/vty_interface.c
+++ b/src/host/layer23/src/mobile/vty_interface.c
@@ -65,6 +65,12 @@
 	1
 };
 
+struct cmd_node audio_node = {
+	AUDIO_NODE,
+	"%s(audio)# ",
+	1
+};
+
 static void print_vty(void *priv, const char *fmt, ...)
 {
 	char buffer[1000];
@@ -1526,6 +1532,16 @@
 		vty_out(vty, " c7-any-timeout %d%s",
 			set->any_timeout, VTY_NEWLINE);
 
+	vty_out(vty, " audio%s", VTY_NEWLINE);
+	switch (set->audio.io_target) {
+	case AUDIO_IO_NONE:
+		vty_out(vty, "  no io-target%s", VTY_NEWLINE);
+		break;
+	default:
+		vty_out(vty, "  io-target %s%s", audio_io_target_name(set->audio.io_target), VTY_NEWLINE);
+		break;
+	}
+
 	/* no shutdown must be written to config, because shutdown is default */
 	vty_out(vty, " %sshutdown%s", (ms->shutdown != MS_SHUTDOWN_NONE) ? "" : "no ",
 		VTY_NEWLINE);
@@ -2727,6 +2743,48 @@
 	return CMD_SUCCESS;
 }
 
+/* per audio config */
+DEFUN(cfg_ms_audio, cfg_ms_audio_cmd, "audio",
+	"Configure audio settings")
+{
+	vty->node = AUDIO_NODE;
+
+	return CMD_SUCCESS;
+}
+
+static int set_audio_io_target(struct gsm_settings *set, enum audio_io_target val)
+{
+	/* Don't restart on unchanged value */
+	if (val == set->audio.io_target)
+		return CMD_SUCCESS;
+	set->audio.io_target = val;
+
+	/* Restart required */
+	vty_restart_if_started(vty, ms);
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(cfg_ms_audio_io_target, cfg_ms_audio_io_target_cmd,
+	"io-target loopback", "Set TCH frame I/O target\n"
+	"Return TCH frame payload back to sender\n")
+
+{
+	struct osmocom_ms *ms = vty->index;
+	struct gsm_settings *set = &ms->settings;
+
+	return set_audio_io_target(set, get_string_value(audio_io_target_names, argv[0]));
+}
+
+DEFUN(cfg_ms_audio_no_io_target, cfg_ms_audio_no_io_target_cmd,
+	"no io-target", NO_STR "Disable TCH frame processing")
+{
+	struct osmocom_ms *ms = vty->index;
+	struct gsm_settings *set = &ms->settings;
+
+	return set_audio_io_target(set, AUDIO_IO_NONE);
+}
+
 DEFUN(cfg_no_shutdown, cfg_ms_no_shutdown_cmd, "no shutdown",
 	NO_STR "Activate and run MS")
 {
@@ -2807,6 +2865,7 @@
 		break;
 	case TESTSIM_NODE:
 	case SUPPORT_NODE:
+	case AUDIO_NODE:
 		vty->node = MS_NODE;
 		break;
 	default:
@@ -2918,6 +2977,7 @@
 	install_element(MS_NODE, &cfg_ms_abbrev_cmd);
 	install_element(MS_NODE, &cfg_ms_no_abbrev_cmd);
 	install_element(MS_NODE, &cfg_ms_testsim_cmd);
+	install_element(MS_NODE, &cfg_ms_audio_cmd);
 	install_element(MS_NODE, &cfg_ms_neighbour_cmd);
 	install_element(MS_NODE, &cfg_ms_no_neighbour_cmd);
 	install_element(MS_NODE, &cfg_ms_any_timeout_cmd);
@@ -2995,6 +3055,10 @@
 	install_element(MS_NODE, &cfg_ms_script_load_run_cmd);
 	install_element(MS_NODE, &cfg_ms_no_script_load_run_cmd);
 
+	install_node(&audio_node, config_write_dummy);
+	install_element(AUDIO_NODE, &cfg_ms_audio_io_target_cmd);
+	install_element(AUDIO_NODE, &cfg_ms_audio_no_io_target_cmd);
+
 	/* Register the talloc context introspection command */
 	osmo_talloc_vty_add_cmds();
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/17593
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Ie03e4a6c6f81ea3925266dd22e87506d722a6e1a
Gerrit-Change-Number: 17593
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200324/459e1224/attachment.htm>


More information about the gerrit-log mailing list