Skip to content

Commit 2c1f269

Browse files
committed
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.
1 parent f34e16d commit 2c1f269

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

extmod/modbluetooth_nimble.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static int characteristic_access_cb(uint16_t conn_handle, uint16_t value_handle,
430430
return BLE_ATT_ERR_ATTR_NOT_FOUND;
431431
}
432432
entry = MP_OBJ_TO_PTR(elem->value);
433-
entry->data_len = MIN(MP_BLUETOOTH_MAX_ATTR_SIZE, OS_MBUF_PKTLEN(ctxt->om));
433+
entry->data_len = MIN(entry->data_alloc, OS_MBUF_PKTLEN(ctxt->om));
434434
os_mbuf_copydata(ctxt->om, 0, entry->data_len, entry->data);
435435

436436
mp_bluetooth_gatts_on_write(conn_handle, value_handle);

0 commit comments

Comments
 (0)