Bluetooth: ATT: Fix handling to EATT channels
EATT channels use bt_l2cap_chan_send which does return the number of bytes sent on success not 0 as bt_l2cap_send. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
f72aef15d2
commit
6c7a387e9f
1 changed files with 12 additions and 2 deletions
|
@ -154,6 +154,8 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf,
|
|||
|
||||
if (IS_ENABLED(CONFIG_BT_EATT) &&
|
||||
atomic_test_bit(chan->flags, ATT_ENHANCED)) {
|
||||
int err;
|
||||
|
||||
/* Check if sent is pending already, if it does it cannot be
|
||||
* modified so the operation will need to be queued.
|
||||
*/
|
||||
|
@ -174,7 +176,15 @@ static int chan_send(struct bt_att_chan *chan, struct net_buf *buf,
|
|||
return -EAGAIN;
|
||||
}
|
||||
|
||||
return bt_l2cap_chan_send(&chan->chan.chan, buf);
|
||||
/* bt_l2cap_chan_send does actually return the number of bytes
|
||||
* that could be sent immediatelly.
|
||||
*/
|
||||
err = bt_l2cap_chan_send(&chan->chan.chan, buf);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hdr->code == BT_ATT_OP_SIGNED_WRITE_CMD) {
|
||||
|
@ -233,7 +243,7 @@ static int chan_req_send(struct bt_att_chan *chan, struct bt_att_req *req)
|
|||
|
||||
/* Keep a reference for resending in case of an error */
|
||||
err = chan_send(chan, net_buf_ref(req->buf), NULL);
|
||||
if (err < 0) {
|
||||
if (err) {
|
||||
net_buf_unref(req->buf);
|
||||
chan->req = NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue