Skip to content

Conversation

@jepler
Copy link

@jepler jepler commented Aug 10, 2019

Otherwise, examples like the one attached to the related issue fail
because tud_hid_ready never returns true.

Testing performed: Adapted the example to nrf particle xenon (it was
handy), removed dependency on IR, verified that the problem occurred
before this change, and that it was fixed after this change.

Closes: #2048

My reproducing program:

from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS

import time
time.sleep(1)

keyboard = Keyboard()
time.sleep(1)
try:
    print("about to press", time.monotonic())
    keyboard.press( Keycode.ZERO )
    print("about to release immediately", time.monotonic())
    keyboard.release_all()
    print("released all", time.monotonic())
finally:
    print("reached finally-handler", time.monotonic())
    time.sleep(1)
    print("about to release in finally-handler", time.monotonic())
    keyboard.release_all()

Note that a side-effect of the problem is that messages printed over usb-serial don't appear in a timely fashion either, so pay attention to the time.monotonic() timestamps to understand how long various steps took.

Otherwise, examples like the one attached to the related issue fail
because tud_hid_ready never returns true.

Testing performed: Adapted the example to nrf particle xenon (it was
handy), removed dependency on IR, verified that the problem occurred
before this change, and that it was fixed after this change.

Closes: adafruit#2048
Copy link
Collaborator

@jerryneedell jerryneedell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on PIRKEY_M0 with the code that was failing -- Works now!
Looks good to me! Thanks.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit 9a6e603 into adafruit:master Aug 12, 2019
@jepler jepler deleted the issue2048 branch November 3, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HID issue with CP 5.0

3 participants