summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-06-02 11:49:58 +0000
committerlaforge <laforge@99fdad57-331a-0410-800a-d7fa5415bdb3>2007-06-02 11:49:58 +0000
commit9c50224314e4316837d2fa0cccddc01482dbc0fe (patch)
treeb4104ef9ce8c26547589ce36f9df94d112263d71 /src
parent912d24fcd318dfb5b615a2d2857fa7e5611fd5ff (diff)
remove stupid default serial port /dev/ttyUSB0
git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@2128 99fdad57-331a-0410-800a-d7fa5415bdb3
Diffstat (limited to 'src')
-rw-r--r--src/gsmd/gsmd.c22
1 files changed, 17 insertions, 5 deletions
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 <laforge@gnumonks.org>\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) {
personal git repositories of Harald Welte. Your mileage may vary