summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-03-15 11:25:30 +0100
committerHarald Welte <laforge@gnumonks.org>2013-03-15 11:25:30 +0100
commitda770f8f34662a298647a75698a718705047d3dc (patch)
tree4f8586785f21c6af62e0b0e158aa47467322b63e /src/util
parent3ec111676ff9e34058b3bf2e482a236f341c10eb (diff)
cell_log: power-cycle the modem on CME ERROR 515
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