changeset 842:9da5fb3f42dd

fc-tmsync aur-all command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 31 Jul 2021 09:06:30 +0000
parents 379574e5cf5e
children 6a0fcbca8ac7
files rvinterf/etmsync/tmsaur.c rvinterf/etmsync/tmscmdtab.c
diffstat 2 files changed, 130 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/etmsync/tmsaur.c	Sat Jul 31 08:29:24 2021 +0000
+++ b/rvinterf/etmsync/tmsaur.c	Sat Jul 31 09:06:30 2021 +0000
@@ -46,6 +46,14 @@
 	return(0);
 }
 
+static int
+convert_signed_byte(b)
+{
+	if (b >= 128)
+		b -= 256;
+	return(b);
+}
+
 cmd_aur(argc, argv)
 	char **argv;
 {
@@ -96,10 +104,7 @@
 	case AUDIO_SPEAKER_FILTER:
 	case AUDIO_SPEAKER_BUZZER_STATE:
 	case AUDIO_MICROPHONE_SPEAKER_LOOP_SIDETONE:
-		i = data[0];
-		if (i >= 128)
-			i -= 256;
-		printf("%d\n", i);
+		printf("%d\n", convert_signed_byte(data[0]));
 		break;
 	case AUDIO_MICROPHONE_FIR:
 	case AUDIO_SPEAKER_FIR:
@@ -127,3 +132,122 @@
 	}
 	return(0);
 }
+
+cmd_aur_all(argc, argv)
+	char **argv;
+{
+	u_char data[62];
+	unsigned mic_mode, speaker_mode, word;
+	int rc, i;
+
+	rc = do_aur(AUDIO_PATH_USED, data, 1);
+	if (rc)
+		return(rc);
+	printf("voice-path %u\n", data[0]);
+
+	rc = do_aur(AUDIO_MICROPHONE_MODE, data, 1);
+	if (rc)
+		return(rc);
+	mic_mode = data[0];
+	switch (mic_mode) {
+	case AUDIO_MICROPHONE_HANDHELD:
+		printf("mic default {\n");
+		break;
+	case AUDIO_MICROPHONE_HANDFREE:
+		printf("mic aux {\n");
+		break;
+	case AUDIO_MICROPHONE_HEADSET:
+		printf("mic headset {\n");
+		break;
+	default:
+		fprintf(stderr, "error: unknown microphone mode 0x%02X\n",
+			mic_mode);
+		return(ERROR_TARGET);
+	}
+	rc = do_aur(AUDIO_MICROPHONE_GAIN, data, 1);
+	if (rc)
+		return(rc);
+	printf("\tgain %d\n", convert_signed_byte(data[0]));
+	if (mic_mode == AUDIO_MICROPHONE_HANDFREE) {
+		rc = do_aur(AUDIO_MICROPHONE_EXTRA_GAIN, data, 1);
+		if (rc)
+			return(rc);
+		printf("\textra-gain %d\n", convert_signed_byte(data[0]));
+	}
+	rc = do_aur(AUDIO_MICROPHONE_OUTPUT_BIAS, data, 1);
+	if (rc)
+		return(rc);
+	printf("\toutput-bias %d\n", convert_signed_byte(data[0]));
+	rc = do_aur(AUDIO_MICROPHONE_FIR, data, 62);
+	if (rc)
+		return(rc);
+	for (i = 0; i < 31; i++) {
+		if ((i % 8) == 0)
+			printf("\tfir %2d", i);
+		printf(" 0x%04X", (data[i*2+1] << 8) | data[i*2]);
+		if (i == 7 || i == 15 || i == 23 || i == 30)
+			putchar('\n');
+	}
+	puts("}");
+
+	rc = do_aur(AUDIO_SPEAKER_MODE, data, 1);
+	if (rc)
+		return(rc);
+	speaker_mode = data[0];
+	switch (speaker_mode) {
+	case AUDIO_SPEAKER_HANDHELD:
+		printf("speaker ear {\n");
+		break;
+	case AUDIO_SPEAKER_HANDFREE:
+		printf("speaker aux {\n");
+		break;
+	case AUDIO_SPEAKER_HEADSET:
+		printf("speaker headset {\n");
+		break;
+	case AUDIO_SPEAKER_HANDHELD_HANDFREE:
+		printf("speaker ear+aux {\n");
+		break;
+	default:
+		fprintf(stderr, "error: unknown speaker mode 0x%02X\n",
+			speaker_mode);
+		return(ERROR_TARGET);
+	}
+	rc = do_aur(AUDIO_SPEAKER_GAIN, data, 1);
+	if (rc)
+		return(rc);
+	printf("\tgain %d\n", convert_signed_byte(data[0]));
+	rc = do_aur(AUDIO_SPEAKER_FILTER, data, 1);
+	if (rc)
+		return(rc);
+	printf("\taudio-filter %d\n", convert_signed_byte(data[0]));
+	rc = do_aur(AUDIO_SPEAKER_FIR, data, 62);
+	if (rc)
+		return(rc);
+	for (i = 0; i < 31; i++) {
+		if ((i % 8) == 0)
+			printf("\tfir %2d", i);
+		printf(" 0x%04X", (data[i*2+1] << 8) | data[i*2]);
+		if (i == 7 || i == 15 || i == 23 || i == 30)
+			putchar('\n');
+	}
+	puts("}");
+
+	rc = do_aur(AUDIO_MICROPHONE_SPEAKER_LOOP_SIDETONE, data, 1);
+	if (rc)
+		return(rc);
+	printf("sidetone %d\n", convert_signed_byte(data[0]));
+	rc = do_aur(AUDIO_MICROPHONE_SPEAKER_LOOP_AEC, data, 24);
+	if (rc)
+		return(rc);
+	fputs("aec-new", stdout);
+	for (i = 0; i < 12; i++) {
+		putchar(' ');
+		word = (data[i*2+1] << 8) | data[i*2];
+		if (word)
+			printf("0x%X", word);
+		else
+			putchar('0');
+	}
+	putchar('\n');
+	return(0);
+}
--- a/rvinterf/etmsync/tmscmdtab.c	Sat Jul 31 08:29:24 2021 +0000
+++ b/rvinterf/etmsync/tmscmdtab.c	Sat Jul 31 09:06:30 2021 +0000
@@ -5,6 +5,7 @@
 #include "cmdtab.h"
 
 extern int cmd_aur();
+extern int cmd_aur_all();
 extern int cmd_dieid();
 extern int cmd_exec();
 extern int cmd_exit();
@@ -22,6 +23,7 @@
 
 struct cmdtab cmdtab[] = {
 	{"aur", 1, 1, cmd_aur},
+	{"aur-all", 0, 0, cmd_aur_all},
 	{"dieid", 0, 0, cmd_dieid},
 	{"exec", 1, 1, cmd_exec},
 	{"exit", 0, 0, cmd_exit},