summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gsmd/gsmd.c11
-rw-r--r--src/gsmd/log.c2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/gsmd/gsmd.c b/src/gsmd/gsmd.c
index c213a6f..3bb25a6 100644
--- a/src/gsmd/gsmd.c
+++ b/src/gsmd/gsmd.c
@@ -51,6 +51,8 @@
#define GSMD_ALIVE_INTERVAL 5*60
#define GSMD_ALIVE_TIMEOUT 30
+extern int loglevel;
+
static struct gsmd g;
static int daemonize = 0;
@@ -318,6 +320,7 @@ static struct option opts[] = {
{ "device", 1, NULL, 'p' },
{ "speed", 1, NULL, 's' },
{ "logfile", 1, NULL, 'l' },
+ { "loglevel", 1, NULL, 'e' },
{ "hwflow", 0, NULL, 'F' },
{ "leak-report", 0, NULL, 'L' },
{ "vendor", 1, NULL, 'v' },
@@ -348,6 +351,7 @@ static void print_usage(void)
"\t-F\t--hwflow\tHardware Flow Control (RTS/CTS)\n"
"\t-L\t--leak-report\tLeak Report of talloc memory allocator\n"
"\t-l file\t--logfile file\tSpecify a logfile to log to\n"
+ "\t-e <0-255>\t--loglevel <0-255>\tSpecify the log level (1=debug, 8=fatal)\n"
"\t-v\t--vendor v\tSpecify GSM modem vendor plugin\n"
"\t-m\t--machine m\tSpecify GSM modem machine plugin\n"
"\t-w\t--wait m\tWait for the AT Interpreter Ready message\n"
@@ -391,7 +395,7 @@ int main(int argc, char **argv)
print_header();
/*FIXME: parse commandline, set daemonize, device, ... */
- while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:v:m:w:", opts, NULL)) != -1) {
+ while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:e:v:m:w:", opts, NULL)) != -1) {
switch (argch) {
case 'V':
print_version();
@@ -423,6 +427,9 @@ int main(int argc, char **argv)
exit(2);
}
break;
+ case 'e':
+ loglevel = atoi(optarg);
+ break;
case 'v':
vendor_name = optarg;
break;
@@ -514,7 +521,7 @@ int main(int argc, char **argv)
if (errno == EINTR)
continue;
else {
- DEBUGP("select returned error (%s)\n",
+ gsmd_log(GSMD_ERROR, "select returned error (%s)\n",
strerror(errno));
break;
}
diff --git a/src/gsmd/log.c b/src/gsmd/log.c
index c0eea81..be1292d 100644
--- a/src/gsmd/log.c
+++ b/src/gsmd/log.c
@@ -37,7 +37,7 @@
static FILE *logfile;
static FILE syslog_dummy;
-static int loglevel;
+int loglevel;
static int gsmd2syslog[] = {
[GSMD_DEBUG] = LOG_DEBUG,
personal git repositories of Harald Welte. Your mileage may vary