Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Keyboard timeout handling: bug?

  1. #1
    Junior Member
    Join Date
    Dec 2018
    Posts
    1

    Keyboard timeout handling: bug?

    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?

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,258
    you're right, transmit_previous_timeout gets never reset to 0
    would be good to fix that and do a pullrequest @ github

    https://github.com/PaulStoffregen/co...eyboard.c#L495

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •