Skip to content

Commit afe0882

Browse files
joerchancarlescufi
authored andcommitted
Bluetooth: ATT: Fix ATT MTU support for larger MTUs
Fix ATT MTU size of length variables resulting in wrong length values reported to the user. Communicating with an Android device using an MTU of 517 resulted in write commands reported as length 2 instead. Signed-off-by: Joakim Andersson <[email protected]>
1 parent 2dca6b3 commit afe0882

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

subsys/bluetooth/host/att.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ struct write_data {
12091209
struct net_buf *buf;
12101210
u8_t req;
12111211
const void *value;
1212-
u8_t len;
1212+
u16_t len;
12131213
u16_t offset;
12141214
u8_t err;
12151215
};
@@ -1249,7 +1249,7 @@ static u8_t write_cb(const struct bt_gatt_attr *attr, void *user_data)
12491249

12501250
static u8_t att_write_rsp(struct bt_conn *conn, u8_t req, u8_t rsp,
12511251
u16_t handle, u16_t offset, const void *value,
1252-
u8_t len)
1252+
u16_t len)
12531253
{
12541254
struct write_data data;
12551255

@@ -1316,7 +1316,7 @@ struct prep_data {
13161316
struct bt_conn *conn;
13171317
struct net_buf *buf;
13181318
const void *value;
1319-
u8_t len;
1319+
u16_t len;
13201320
u16_t offset;
13211321
u8_t err;
13221322
};
@@ -1369,7 +1369,7 @@ static u8_t prep_write_cb(const struct bt_gatt_attr *attr, void *user_data)
13691369
}
13701370

13711371
static u8_t att_prep_write_rsp(struct bt_att *att, u16_t handle, u16_t offset,
1372-
const void *value, u8_t len)
1372+
const void *value, u16_t len)
13731373
{
13741374
struct bt_conn *conn = att->chan.chan.conn;
13751375
struct prep_data data;

subsys/bluetooth/host/gatt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,7 +2826,7 @@ static void gatt_find_info_rsp(struct bt_conn *conn, u8_t err,
28262826
const struct bt_att_find_info_rsp *rsp = pdu;
28272827
struct bt_gatt_discover_params *params = user_data;
28282828
u16_t handle = 0U;
2829-
u8_t len;
2829+
u16_t len;
28302830
union {
28312831
const struct bt_att_info_16 *i16;
28322832
const struct bt_att_info_128 *i128;
@@ -3007,7 +3007,7 @@ static void parse_read_by_uuid(struct bt_conn *conn,
30073007
length -= rsp->len, pdu = (const u8_t *)pdu + rsp->len) {
30083008
const struct bt_att_data *data = pdu;
30093009
u16_t handle;
3010-
u8_t len;
3010+
u16_t len;
30113011

30123012
handle = sys_le16_to_cpu(data->handle);
30133013

0 commit comments

Comments
 (0)