summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/cell_log.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/util/cell_log.c b/src/util/cell_log.c
index 59d8942..a9a3bb7 100644
--- a/src/util/cell_log.c
+++ b/src/util/cell_log.c
@@ -410,11 +410,25 @@ static int cinfo_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdat
return 0;
}
+static int error_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux)
+{
+ int err = aux->u.cme_err.number;
+ syslog(LOG_ERR, "CME ERROR %u from modem\n", err);
+
+ switch (err) {
+ case 515:
+ /* we have seen the modem get stuck here, so re-set it */
+ lgsm_phone_power(lh, 1);
+ break;
+ }
+ return 0;
+}
+
int main(int argc, char **argv)
{
static struct lgsm_handle *lgsmh;
- printf("cell_log - (C) 2012 by Harald Welte <laforge@gnumonks.org>.\n"
+ printf("cell_log - (C) 2012-2013 by Harald Welte <laforge@gnumonks.org>.\n"
"This program is Free Software and has ABSOLUTELY NO WARRANTY\n\n");
openlog("cell_log", 0, LOG_LOCAL0);
@@ -426,6 +440,7 @@ int main(int argc, char **argv)
}
lgsm_evt_handler_register(lgsmh, GSMD_EVT_CELLINFO, &cinfo_handler);
+ lgsm_evt_handler_register(lgsmh, GSMD_EVT_IN_ERROR, &error_handler);
we_have_seen_network(23, 42);
celllog_main(lgsmh);
personal git repositories of Harald Welte. Your mileage may vary