Bluetooth: L2CAP: Fix handling LE modes by L2CAP_OPTIONS
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v2 1/2 Bluetooth: L2CAP: Fix handling LE modes by L2CAP_OPTIONS
From: Luiz Augusto von Dentz <[email protected]>
L2CAP_OPTIONS shall only be used with BR/EDR modes.
--- net/bluetooth/l2cap_sock.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
net/bluetooth/l2cap_sock.c +21 -4
@@ -424,6 +424,20 @@ static int l2cap_sock_getsockopt_old(struct socket *sock, int optname,break ; } +/* Only BR/EDR modes are supported here */ +switch (chan->mode) { +case L2CAP_MODE_BASIC : +case L2CAP_MODE_ERTM : +case L2CAP_MODE_STREAMING : +break ; +default : + err = -EINVAL ; +break ; + } + +if (err <0 ) +break ; +memset (&opts,0 ,sizeof (opts)); opts.imtu = chan->imtu; opts.omtu = chan->omtu;
@@ -698,10 +712,8 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,break ; } - chan->mode = opts.mode; -switch (chan->mode) { -case L2CAP_MODE_LE_FLOWCTL : -break ; +/* Only BR/EDR modes are supported here */ +switch (opts.mode) {case L2CAP_MODE_BASIC :clear_bit (CONF_STATE2_DEVICE , &chan->conf_state);break ;
@@ -715,6 +727,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname,break ; } +if (err <0 ) +break ; + + chan->mode = opts.mode; +BT_DBG ("mode 0x%2.2x" , chan->mode); chan->imtu = opts.imtu;
Signature · 1 line
2.21.1
Luiz Augusto von Dentz
maintainerPATCH v2 2/2 Bluetooth: Add BT_MODE socket option
From: Luiz Augusto von Dentz <[email protected]>
This adds BT_MODE socket option which can be used to set L2CAP modes, including modes only supported over LE which were not supported using the L2CAP_OPTIONS.
--- include/net/bluetooth/bluetooth.h | 8 +++ net/bluetooth/l2cap_sock.c | 113 +++++++++++++++++++++++++++++- 2 files changed, 120 insertions(+), 1 deletion(-)
include/net/bluetooth/bluetooth.h +8 -0
@@ -139,6 +139,14 @@ struct bt_voice {#define BT_PHY_LE_CODED_TX 0x00002000#define BT_PHY_LE_CODED_RX 0x00004000 +#define BT_MODE 15 + +#define BT_MODE_BASIC 0x00 +#define BT_MODE_ERTM 0x01 +#define BT_MODE_STREAMING 0x02 +#define BT_MODE_LE_FLOWCTL 0x03 +#define BT_MODE_EXT_FLOWCTL 0x04 + __printf(1, 2)void bt_info (const char *fmt, ...);__printf (1 ,2 )
net/bluetooth/l2cap_sock.c +112 -1
143 lines not on this page · raw message
Signature · 1 line
2.21.1
Marcel Holtmann
maintainerRe: [PATCH v2 2/2] Bluetooth: Add BT_MODE socket option
Hi Luiz,
Quoted 9 lines
This adds
BT_MODEsocket option which can be used to set L2CAP modes, including modes only supported over LE which were not supported using theL2CAP_OPTIONS.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
include/net/bluetooth/bluetooth.h| 8 +++net/bluetooth/l2cap_sock.c| 113 +++++++++++++++++++++++++++++-2 files changed, 120 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
Marcel Holtmann
maintainerHi Luiz,
Quoted 6 lines
L2CAP_OPTIONSshall only be used with BR/EDR modes.Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/l2cap_sock.c| 25 +++++++++++++++++++++----1 file changed, 21 insertions(+), 4 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel