changeset 913:091ebd46a9cc

user-friendly set-rfcap implemented in fc-fsio
author Space Falcon <falcon@ivan.Harhan.ORG>
date Tue, 08 Sep 2015 08:55:21 +0000
parents f50c71442d50
children de0505be800d
files rvinterf/etmsync/Makefile rvinterf/etmsync/fscmdtab.c rvinterf/etmsync/fsmisc.c rvinterf/etmsync/rfcap.c
diffstat 4 files changed, 61 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/etmsync/Makefile	Tue Sep 08 08:18:42 2015 +0000
+++ b/rvinterf/etmsync/Makefile	Tue Sep 08 08:55:21 2015 +0000
@@ -5,7 +5,8 @@
 
 FSIO_OBJS=	connect.o dispatch.o fdcmd.o fileio.o fsbasics.o fscmdtab.o \
 		fserr.o fsiomain.o fsmisc.o fspath.o fsread.o fsupload.o \
-		fswrite.o interf.o launchrvif.o memcmd.o memops.o symlink.o
+		fswrite.o interf.o launchrvif.o memcmd.o memops.o rfcap.o \
+		symlink.o
 
 all:	${PROGS}
 
--- a/rvinterf/etmsync/fscmdtab.c	Tue Sep 08 08:18:42 2015 +0000
+++ b/rvinterf/etmsync/fscmdtab.c	Tue Sep 08 08:55:21 2015 +0000
@@ -23,6 +23,7 @@
 extern int cmd_readlink();
 extern int cmd_set_imeisv();
 extern int cmd_set_pcm_string();
+extern int cmd_set_rfcap();
 extern int cmd_stat();
 extern int cmd_symlink();
 extern int cmd_uploadfs();
@@ -49,6 +50,7 @@
 	{"readlink", 1, 1, cmd_readlink},
 	{"set-imeisv", 2, 2, cmd_set_imeisv},
 	{"set-pcm-string", 2, 2, cmd_set_pcm_string},
+	{"set-rfcap", 1, 1, cmd_set_rfcap},
 	{"stat", 1, 1, cmd_stat},
 	{"symlink", 2, 2, cmd_symlink},
 	{"upload-file", 2, 2, cmd_upload_file},
--- a/rvinterf/etmsync/fsmisc.c	Tue Sep 08 08:18:42 2015 +0000
+++ b/rvinterf/etmsync/fsmisc.c	Tue Sep 08 08:55:21 2015 +0000
@@ -141,3 +141,9 @@
 	}
 	return do_short_fwrite(filename, argv[2], strlen(argv[2]));
 }
+
+cmd_set_rfcap(argc, argv)
+	char **argv;
+{
+	return set_rfcap(argv[1]);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/etmsync/rfcap.c	Tue Sep 08 08:55:21 2015 +0000
@@ -0,0 +1,51 @@
+/*
+ * Setting of /gsm/com/rfcap
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include "exitcodes.h"
+
+static struct band_table {
+	char	*keyword;
+	u_char	bytes[4];
+} band_table[] = {
+	{"dual-eu",	{0x00, 0x0B, 0x41, 0x00}},
+	{"dual-us",	{0x00, 0x14, 0x00, 0x14}},
+	{"tri900",	{0x00, 0x0F, 0x41, 0x10}},
+	{"tri850",	{0x00, 0x16, 0x01, 0x14}},
+	{"quad",	{0x00, 0x1F, 0x41, 0x14}},
+	{0,		{0x00, 0x00, 0x00, 0x00}}
+};
+
+static u_char rfcap_tail[12] = {0x00, 0x00, 0x00, 0x00,
+				0x50, 0x00, 0x00, 0xA5,
+				0x05, 0x00, 0xC0, 0x00};
+
+set_rfcap(band_config_kw)
+	char *band_config_kw;
+{
+	static char filename[] = "/gsm/com/rfcap";
+	u_char bytes[16];
+	struct band_table *tp;
+
+	for (tp = band_table; tp->keyword; tp++)
+		if (!strcmp(tp->keyword, band_config_kw))
+			break;
+	if (!tp->keyword) {
+		printf("error: band configuration \"%s\" not known\n",
+			band_config_kw);
+		return(ERROR_USAGE);
+	}
+	bcopy(tp->bytes, bytes, 4);
+	bcopy(rfcap_tail, bytes + 4, 12);
+
+	printf("Writing \"%02X %02X %02X %02X %02X %02X %02X %02X  %02X %02X %02X %02X %02X %02X %02X %02X\" into %s\n",
+		bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5],
+		bytes[6], bytes[7], bytes[8], bytes[9], bytes[10], bytes[11],
+		bytes[12], bytes[13], bytes[14], bytes[15], filename);
+	return do_short_fwrite(filename, bytes, 16);
+}