Keyboard timeout handling: bug?

jorj

Member
Teensyduino 1.45's keyboard handling (usb_keyboard.c) has this common pattern twice:

Code:
        while (1) {
                if (!usb_configuration) {
                        return -1;
		}
                if (usb_tx_packet_count(KEYBOARD_ENDPOINT) < TX_PACKET_LIMIT) {
                        tx_packet = usb_malloc();
                        if (tx_packet) break;
		}
                if (++wait_count > TX_TIMEOUT || transmit_previous_timeout) {
			transmit_previous_timeout = 1;
                        return -1;
                }
                yield();
        }

... but nowhere does it reset transmit_previous_timeout to 0 after the loop. So if there's any timeout, ever, the keyboard is dead.

Should this have a transmit_previous_timeout = 0 at the end of both of those loops?
 
Back
Top