]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Master mode remains active
authorFred Sundvik <fsundvik@gmail.com>
Sun, 13 Mar 2016 19:38:51 +0000 (21:38 +0200)
committerFred Sundvik <fsundvik@gmail.com>
Sun, 13 Mar 2016 19:38:51 +0000 (21:38 +0200)
It remains active even if the USB link is suspended or otherwise
temporarilly goes down.

serial_link/system/system.c

index 5406db3f4867cb795bbe8fd612e10d3939ea36fc..f74d8c9e9eb6f5f4e57819570fb2525db9f0ef78 100644 (file)
@@ -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;