From a72236a1d0effb1fe985f5685d40e6dc33ab65a3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 27 Sep 2013 22:42:41 +0200 Subject: permit gsmd and libgsm to handle multiple instances By using differntly-named unix domain sockets, we can run multiple gsmd instances in parallel. --- src/util/libgsmd-tool.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/util') diff --git a/src/util/libgsmd-tool.c b/src/util/libgsmd-tool.c index 5fb1eca..4ef3df5 100644 --- a/src/util/libgsmd-tool.c +++ b/src/util/libgsmd-tool.c @@ -73,6 +73,7 @@ static int parse_mode(char *modestr) static struct option opts[] = { { "help", 0, 0, 'h' }, + { "instance", 1, 0, 'i' }, { "version", 0, 0, 'V' }, { "verbose", 0, 0, 'v' }, { "mode", 1, 0, 'm' }, @@ -85,6 +86,7 @@ static void help(void) { printf("Usage:\n" "\t-h\t--help\tPrint this Help message\n" + "\t-i\t--instance <0-255>\tWhich instance nubmer to use\n" "\t-V\t--version\tPrint version number\n" "\t-v\t--verbose\tBe more verbose\n" "\t-m\t--mode\tSet mode {shell,eventlog,atcmd}\n" @@ -100,7 +102,7 @@ static void dump_version(void) int main(int argc, char **argv) { char *pin = NULL; - int mode = MODE_NONE, shellwait = 0; + int mode = MODE_NONE, shellwait = 0, instance = 0; printf("libgsm-tool - (C) 2006-2007 by Harald Welte and OpenMoko, Inc.\n" " (C) 2012-2013 by Harald Welte\n" @@ -108,7 +110,7 @@ int main(int argc, char **argv) while (1) { int c, option_index = 0; - c = getopt_long(argc, argv, "vVhwm:p:", opts, &option_index); + c = getopt_long(argc, argv, "vVhi:wm:p:", opts, &option_index); if (c == -1) break; @@ -124,6 +126,9 @@ int main(int argc, char **argv) help(); exit(0); break; + case 'i': + instance = atoi(optarg); + break; case 'm': mode = parse_mode(optarg); if (mode < 0) { @@ -140,7 +145,7 @@ int main(int argc, char **argv) } } - lgsmh = lgsm_init(LGSMD_DEVICE_GSMD); + lgsmh = lgsm_init_inst(instance); if (!lgsmh) { fprintf(stderr, "Can't connect to gsmd\n"); exit(1); -- cgit v1.2.3