diff options
author | Damien George <damien@micropython.org> | 2024-02-11 15:08:08 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-02-12 11:26:27 +1100 |
commit | abe43fe6873bf78c98634eac74de646f70ec0d32 (patch) | |
tree | 6e0b6a5b649840202ce8eeaacf6c65ad2da158fd /extmod/btstack/modbluetooth_btstack.c | |
parent | b4f59984f7668db457280c1f4007618fd1d235f6 (diff) | |
download | micropython-abe43fe6873bf78c98634eac74de646f70ec0d32.tar.gz micropython-abe43fe6873bf78c98634eac74de646f70ec0d32.zip |
extmod/btstack: Reset pending_value_handle before calling read-done cb.
Similar to the previous commit but for MP_BLUETOOTH_IRQ_GATTC_READ_DONE:
the pending_value_handle needs to be 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 #13634.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/btstack/modbluetooth_btstack.c')
-rw-r--r-- | extmod/btstack/modbluetooth_btstack.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extmod/btstack/modbluetooth_btstack.c b/extmod/btstack/modbluetooth_btstack.c index 08d64ab012..b3d349c2dc 100644 --- a/extmod/btstack/modbluetooth_btstack.c +++ b/extmod/btstack/modbluetooth_btstack.c @@ -462,8 +462,9 @@ STATIC void btstack_packet_handler_read(uint8_t packet_type, uint16_t channel, u if (!conn) { return; } - mp_bluetooth_gattc_on_read_write_status(MP_BLUETOOTH_IRQ_GATTC_READ_DONE, conn_handle, conn->pending_value_handle, status); + uint16_t value_handle = conn->pending_value_handle; conn->pending_value_handle = 0xffff; + mp_bluetooth_gattc_on_read_write_status(MP_BLUETOOTH_IRQ_GATTC_READ_DONE, conn_handle, value_handle, status); } else if (event_type == GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT) { DEBUG_printf(" --> gatt characteristic value query result\n"); uint16_t conn_handle = gatt_event_characteristic_value_query_result_get_handle(packet); |