summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2019-10-22 01:03:17 +1100
committerJim Mussared <jim.mussared@gmail.com>2019-10-22 14:30:23 +1100
commit2c1f269918331a50678119410219e965fcdb822e (patch)
tree940365c79fc1f4b1784545951fc55373d0d56643
parentf34e16dbc6648a46590501bbc5e4b146bd032eef (diff)
extmod/modbluetooth_nimble: Use `data_alloc` length to truncate writes.
This allows the maximum size of a characteristic/descriptor to be increased by locally writing to it first.
-rw-r--r--extmod/modbluetooth_nimble.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/modbluetooth_nimble.c b/extmod/modbluetooth_nimble.c
index d87336858..6287ca89e 100644
--- a/extmod/modbluetooth_nimble.c
+++ b/extmod/modbluetooth_nimble.c
@@ -430,7 +430,7 @@ static int characteristic_access_cb(uint16_t conn_handle, uint16_t value_handle,
return BLE_ATT_ERR_ATTR_NOT_FOUND;
}
entry = MP_OBJ_TO_PTR(elem->value);
- entry->data_len = MIN(MP_BLUETOOTH_MAX_ATTR_SIZE, OS_MBUF_PKTLEN(ctxt->om));
+ entry->data_len = MIN(entry->data_alloc, OS_MBUF_PKTLEN(ctxt->om));
os_mbuf_copydata(ctxt->om, 0, entry->data_len, entry->data);
mp_bluetooth_gatts_on_write(conn_handle, value_handle);