diff --git a/src/manager.c b/src/manager.c index 17e58b2..423cbfa 100644 --- a/src/manager.c +++ b/src/manager.c @@ -121,7 +121,7 @@ static gboolean modem_reset_done(struct EG25Manager* manager) void modem_reset(struct EG25Manager *manager) { - int fd, ret, len = strlen(manager->modem_usb_id); + int fd, ret, len; if (manager->reset_timer) return; @@ -131,6 +131,13 @@ void modem_reset(struct EG25Manager *manager) manager->suspend_timer = 0; } + if (!manager->modem_usb_id) { + g_warning("Unknown modem USB ID"); + goto error; + } + + len = strlen(manager->modem_usb_id); + manager->modem_state = EG25_STATE_RESETTING; fd = open("/sys/bus/usb/drivers/usb/unbind", O_WRONLY);