From da770f8f34662a298647a75698a718705047d3dc Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 15 Mar 2013 11:25:30 +0100 Subject: cell_log: power-cycle the modem on CME ERROR 515 --- src/util/cell_log.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/util') 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 .\n" + printf("cell_log - (C) 2012-2013 by Harald Welte .\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); -- cgit v1.2.3