summaryrefslogtreecommitdiff
path: root/src/gsmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/gsmd')
-rw-r--r--src/gsmd/gsmd.c7
-rw-r--r--src/gsmd/usock.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c
index 9389f5f..20daa7f 100644
--- a/src/gsmd/gsmd.c
+++ b/src/gsmd/gsmd.c
@@ -317,6 +317,7 @@ static struct option opts[] = {
{ "version", 0, NULL, 'V' },
{ "daemon", 0, NULL, 'd' },
{ "help", 0, NULL, 'h' },
+ { "instance", 1, NULL, 'i' },
{ "device", 1, NULL, 'p' },
{ "speed", 1, NULL, 's' },
{ "logfile", 1, NULL, 'l' },
@@ -347,6 +348,7 @@ static void print_usage(void)
"\t-V\t--version\tDisplay program version\n"
"\t-d\t--daemon\tDeamonize\n"
"\t-h\t--help\t\tDisplay this help message\n"
+ "\t-i\t--instance <0-255>\t\tInstance number to use\n"
"\t-p dev\t--device dev\tSpecify serial device to be used\n"
"\t-s spd\t--speed spd\tSpecify speed in bps (9600,38400,115200,...)\n"
"\t-F\t--hwflow\tHardware Flow Control (RTS/CTS)\n"
@@ -396,7 +398,7 @@ int main(int argc, char **argv)
print_header();
/*FIXME: parse commandline, set daemonize, device, ... */
- while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:e:v:m:w:", opts, NULL)) != -1) {
+ while ((argch = getopt_long(argc, argv, "FVLdhi:p:s:l:e:v:m:w:", opts, NULL)) != -1) {
switch (argch) {
case 'V':
print_version();
@@ -416,6 +418,9 @@ int main(int argc, char **argv)
print_usage();
exit(0);
break;
+ case 'i':
+ g.instance = atoi(optarg);
+ break;
case 'p':
device = optarg;
break;
diff --git a/src/gsmd/usock.c b/src/gsmd/usock.c
index f258fd6..41814c8 100644
--- a/src/gsmd/usock.c
+++ b/src/gsmd/usock.c
@@ -1734,7 +1734,14 @@ int usock_init(struct gsmd *g)
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
- memcpy(sun.sun_path, GSMD_UNIX_SOCKET, sizeof(GSMD_UNIX_SOCKET));
+ if (g->instance == 0) {
+ memcpy(sun.sun_path, GSMD_UNIX_SOCKET,
+ sizeof(GSMD_UNIX_SOCKET));
+ } else {
+ sun.sun_path[0] = '\0';
+ snprintf(sun.sun_path+1, sizeof(sun.sun_path)-1, "gsmd.%u",
+ g->instance);
+ }
rc = bind(fd, (struct sockaddr *)&sun, sizeof(sun));
if (rc < 0) {
personal git repositories of Harald Welte. Your mileage may vary