From 9c50224314e4316837d2fa0cccddc01482dbc0fe Mon Sep 17 00:00:00 2001 From: laforge Date: Sat, 2 Jun 2007 11:49:58 +0000 Subject: remove stupid default serial port /dev/ttyUSB0 git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2128 99fdad57-331a-0410-800a-d7fa5415bdb3 --- src/gsmd/gsmd.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/gsmd') diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c index 27bf8d9..3105bee 100644 --- a/src/gsmd/gsmd.c +++ b/src/gsmd/gsmd.c @@ -163,11 +163,15 @@ static struct option opts[] = { { 0, 0, 0, 0 } }; -static void print_help(void) +static void print_header(void) { printf("gsmd - (C) 2006-2007 by Harald Welte \n" - "This program is FREE SOFTWARE under the terms of GNU GPL\n\n" - "Usage:\n" + "This program is FREE SOFTWARE under the terms of GNU GPL\n\n"); +} + +static void print_usage(void) +{ + printf("Usage:\n" "\t-V\t--version\tDisplay program version\n" "\t-d\t--daemon\tDeamonize\n" "\t-h\t--help\t\tDisplay this help message\n" @@ -202,7 +206,7 @@ int main(int argc, char **argv) int daemonize = 0; int bps = 115200; int hwflow = 0; - char *device = "/dev/ttyUSB0"; + char *device = NULL; char *logfile = "syslog"; char *vendor_name = NULL; char *machine_name = NULL; @@ -214,6 +218,8 @@ int main(int argc, char **argv) gsmd_tallocs = talloc_named_const(NULL, 1, "GSMD"); + print_header(); + /*FIXME: parse commandline, set daemonize, device, ... */ while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:", opts, NULL)) != -1) { switch (argch) { @@ -231,7 +237,7 @@ int main(int argc, char **argv) break; case 'h': /* FIXME */ - print_help(); + print_usage(); exit(0); break; case 'p': @@ -255,6 +261,12 @@ int main(int argc, char **argv) } } + if (!device) { + fprintf(stderr, "ERROR: you have to specify a port (-p port)\n"); + print_usage(); + exit(2); + } + /* use direct access to device node ([virtual] tty device) */ fd = open(device, O_RDWR); if (fd < 0) { -- cgit v1.2.3