diff options
author | Harald Welte <laforge@gnumonks.org> | 2013-09-27 22:42:41 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2013-09-29 14:56:44 +0200 |
commit | a72236a1d0effb1fe985f5685d40e6dc33ab65a3 (patch) | |
tree | b4ab5e143ff7631ee53f8691ce4a713f33c3f587 /src/util | |
parent | 292e73a08c3445b4aa96057e559dbcec44b0d8f7 (diff) |
permit gsmd and libgsm to handle multiple instances
By using differntly-named unix domain sockets, we can run
multiple gsmd instances in parallel.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/libgsmd-tool.c | 11 |
1 files changed, 8 insertions, 3 deletions
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); |