Skip to content

extmod/btstack: Reset pending_value_handle before calling write-done cb. #13618

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

Conversation

dpgeorge
Copy link
Member

@dpgeorge dpgeorge commented Feb 8, 2024

Fixes issue #13611.

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Feb 8, 2024
@dpgeorge
Copy link
Member Author

dpgeorge commented Feb 8, 2024

@redhead-p this should hopefully fix your issue with OSError(114) on Pico W (which uses BTstack).

The test added in this PR is based on your original bug report.

Copy link

codecov bot commented Feb 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8cbae12) 98.36% compared to head (b4f5998) 98.36%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13618   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files         159      159           
  Lines       21069    21069           
=======================================
  Hits        20724    20724           
  Misses        345      345           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Feb 8, 2024

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

The pending_value_handle needs to be freed and reset before calling
mp_bluetooth_gattc_on_read_write_status(), which will call the Python IRQ
handler, which may in turn call back into BTstack to perform an action like
a write.  In that case the pending_value_handle will need to be available
for the write/read/etc to proceed.

Fixes issue micropython#13611.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the extmod-btstack-fix-resetting-pending-value-handle branch from 0da6146 to b4f5998 Compare February 9, 2024 00:46
@dpgeorge dpgeorge merged commit b4f5998 into micropython:master Feb 9, 2024
@dpgeorge dpgeorge deleted the extmod-btstack-fix-resetting-pending-value-handle branch February 9, 2024 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant