Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

espressif/common-hal/_bleio/Characteristic.c: handle empty initial value #9676

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Oct 1, 2024

Characteristic was using self->current_value == NULL to indicate that the Characteristic was deinit-ed. However,
the current_value storage in a Characteristic can be the NULL pointer if the Characteristic is initialized with an initial value of None.

Change to using self->handle = BLEIO_HANDLE_INVALID as the deinit flag (similar to what nordic does), and handle an empty initial value more carefully. For instance, don't try to allocate a zero-length chunk of heap.

Tested with the HID test program in #9669. I did keyboard HID to an iPhone and it works.

@dhalbert dhalbert requested a review from tannewt October 1, 2024 22:32
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 29f64c7 into adafruit:main Oct 2, 2024
110 checks passed
@dhalbert dhalbert deleted the bleio-char-empty-current-value branch October 3, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BLE HID issues on esp32s3
2 participants