diff --git a/USBHost_t36.h b/USBHost_t36.h index 300a324..500b4c6 100644 --- a/USBHost_t36.h +++ b/USBHost_t36.h @@ -669,8 +669,6 @@ private: uint8_t keyOEM; uint8_t prev_report[8]; KBDLeds_t leds_ = {0}; - bool update_leds_ = false; - bool processing_new_data_ = false; Pipe_t mypipes[2] __attribute__ ((aligned(32))); Transfer_t mytransfers[4] __attribute__ ((aligned(32))); strbuf_t mystring_bufs[1]; diff --git a/keyboard.cpp b/keyboard.cpp index b3e9123..93bdabc 100644 --- a/keyboard.cpp +++ b/keyboard.cpp @@ -179,7 +179,6 @@ static bool contains(uint8_t b, const uint8_t *data) void KeyboardController::new_data(const Transfer_t *transfer) { - processing_new_data_ = true; println("KeyboardController Callback (member)"); print(" KB Data: "); print_hexbytes(transfer->buffer, 8); @@ -197,12 +196,6 @@ void KeyboardController::new_data(const Transfer_t *transfer) } memcpy(prev_report, report, 8); queue_Data_Transfer(datapipe, report, 8, this); - processing_new_data_ = false; - - // See if we have any outstanding leds to update - if (update_leds_) { - updateLEDS(); - } } @@ -328,22 +321,9 @@ void KeyboardController::LEDS(uint8_t leds) { } void KeyboardController::updateLEDS() { - println("KBD: Update LEDS", leds_.byte, HEX); - if (processing_new_data_) { - println(" Update defered"); - update_leds_ = true; - return; // defer until later - } - // Now lets tell keyboard new state. - static uint8_t keyboard_keys_report[1] = {0}; - setup_t keys_setup; - keyboard_keys_report[0] = leds_.byte; - queue_Data_Transfer(datapipe, report, 8, this); - mk_setup(keys_setup, 0x21, 9, 0x200, 0, sizeof(keyboard_keys_report)); // hopefully this sets leds - queue_Control_Transfer(device, &keys_setup, keyboard_keys_report, this); - - update_leds_ = false; + mk_setup(setup, 0x21, 9, 0x200, 0, sizeof(leds_.byte)); // hopefully this sets leds + queue_Control_Transfer(device, &setup, &leds_.byte, this); }