apache / apache/mynewt-nimble

Characteristic read response is limited to 19 bytes when reading by UUID

Open
#1,881 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
893
Forks
512
Avg merge
13d 31m
Merged PRs (30d)
7

Description

When reading a characteristic by type/UUID, if the length of the response is greater than 19 bytes, the server will respond with Unlikely Error. This limitation does not exist when reading by handle. According to the Core Specification, the maximum length for a single attribute response when reading by type can be up to 253 bytes, provided that the MTU is large enough to handle it.

This line calls `ble_att_svr_read_flat` with a fixed size buffer, and is likely the culprit:

https://github.com/apache/mynewt-nimble/blob/5baa3f4ba09654e837ab9ed0c1880a67f6a3fbd5/nimble/host/src/ble_att_svr.c#L1318

To the access_cb function, reading a characteristic this way appears to be successful. There's no obvious indication that it will actually return an error to the client.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in nimble/host/src/ble_att_svr.c at the line 1318 call to ble_att_svr_read_flat, then compare the read-by-UUID path with the read-by-handle path. Check how the fixed buffer interacts with the MTU and the access_cb result. Done means a characteristic response longer than 19 bytes can be returned successfully, within the protocol limit, instead of producing Unlikely Error.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.