suppress HID messages when device is disconnected

This commit is contained in:
2026-05-08 12:25:54 -04:00
parent e3620971b1
commit 722a9b489b
2 changed files with 19 additions and 11 deletions
+9 -4
View File
@@ -376,12 +376,17 @@ void startADC() {
// forward HID report after processing
bool forward_report(uint8_t instance, uint8_t const* report, uint16_t len) {
// toggle mute button color if mute button is pressed
if ( instance == 0x02 && report[0] == 0x02 && (report[2] & 0x01) ) {
mute = !mute;
// forward only if device is connected
if (device_state == DEVICE_ACTIVE) {
// toggle mute button color if mute button is pressed
if ( instance == 0x02 && report[0] == 0x02 && (report[2] & 0x01) ) {
mute = !mute;
}
return tud_hid_n_report(instance, 0, report, len);
}
return tud_hid_n_report(instance, 0, report, len);
return true;
}
// save RGB configuration to flash