diff options
author | Fred Sundvik <fsundvik@gmail.com> | 2016-03-13 21:38:51 +0200 |
---|---|---|
committer | Fred Sundvik <fsundvik@gmail.com> | 2016-03-13 21:38:51 +0200 |
commit | 59657355d22cd6f661fda307675c6f712b5542ec (patch) | |
tree | 17fea6110eaf21ca8db3b5fd0bdf09f12818ded3 | |
parent | f7275f0edea61aa0b52160f5dbdeeddb1f0e7176 (diff) |
Master mode remains active
It remains active even if the USB link is suspended or otherwise
temporarilly goes down.
-rw-r--r-- | serial_link/system/system.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/serial_link/system/system.c b/serial_link/system/system.c index 5406db3f48..f74d8c9e9e 100644 --- a/serial_link/system/system.c +++ b/serial_link/system/system.c @@ -88,11 +88,13 @@ static THD_FUNCTION(serialThread, arg) { EVENT_MASK(2), CHN_INPUT_AVAILABLE); bool need_wait = false; + bool is_master = false; while(true) { if (need_wait) { chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); } - bool is_master = usbGetDriverStateI(&USBD1) == USB_ACTIVE; + // Always stay as master, even if the USB goes into sleep mode + is_master |= usbGetDriverStateI(&USBD1) == USB_ACTIVE; router_set_master(is_master); need_wait = true; |