aboutsummaryrefslogtreecommitdiff
path: root/serial_link/system/system.c
diff options
context:
space:
mode:
authorFred Sundvik <fsundvik@gmail.com>2016-03-13 21:38:51 +0200
committerFred Sundvik <fsundvik@gmail.com>2016-03-13 21:38:51 +0200
commit59657355d22cd6f661fda307675c6f712b5542ec (patch)
tree17fea6110eaf21ca8db3b5fd0bdf09f12818ded3 /serial_link/system/system.c
parentf7275f0edea61aa0b52160f5dbdeeddb1f0e7176 (diff)
downloadqmk_firmware-59657355d22cd6f661fda307675c6f712b5542ec.tar.gz
qmk_firmware-59657355d22cd6f661fda307675c6f712b5542ec.zip
Master mode remains active
It remains active even if the USB link is suspended or otherwise temporarilly goes down.
Diffstat (limited to 'serial_link/system/system.c')
-rw-r--r--serial_link/system/system.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/serial_link/system/system.c b/serial_link/system/system.c
index 5406db3f4..f74d8c9e9 100644
--- a/serial_link/system/system.c
+++ b/serial_link/system/system.c
@@ -88,11 +88,13 @@ static THD_FUNCTION(serialThread, arg) {
88 EVENT_MASK(2), 88 EVENT_MASK(2),
89 CHN_INPUT_AVAILABLE); 89 CHN_INPUT_AVAILABLE);
90 bool need_wait = false; 90 bool need_wait = false;
91 bool is_master = false;
91 while(true) { 92 while(true) {
92 if (need_wait) { 93 if (need_wait) {
93 chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); 94 chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000));
94 } 95 }
95 bool is_master = usbGetDriverStateI(&USBD1) == USB_ACTIVE; 96 // Always stay as master, even if the USB goes into sleep mode
97 is_master |= usbGetDriverStateI(&USBD1) == USB_ACTIVE;
96 router_set_master(is_master); 98 router_set_master(is_master);
97 99
98 need_wait = true; 100 need_wait = true;