Skip to content

Commit

Permalink
Initial fix for not resetting rgb on all connected devices #60 (#67)
Browse files Browse the repository at this point in the history
Fixes #60
  • Loading branch information
simon-wh authored Jan 18, 2024
1 parent f421894 commit cdecb6e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/wooting-rgb-sdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,19 @@ bool wooting_rgb_reset_rgb() {
}

bool wooting_rgb_close() {
if (wooting_rgb_reset_rgb()) {
wooting_usb_disconnect(false);
return true;
} else {
return false;
bool result = false;

for (uint8_t i = 0; i < wooting_usb_device_count(); i++) {
if (wooting_usb_select_device(i)) {
result |= wooting_rgb_reset_rgb();
}
}

// The disconnect call disconnects all devices, so we do it after we've
// attempted to reset rgb on all of them
wooting_usb_disconnect(false);

return result;
}

bool wooting_rgb_reset() { return wooting_rgb_close(); }
Expand Down

0 comments on commit cdecb6e

Please sign in to comment.