Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/4] lib: Add definition to BT_PHY
@ 2020-02-19  0:36 Luiz Augusto von Dentz
  2020-02-19  0:36 ` [PATCH BlueZ 2/4] btio: Add BT_IO_PHY option Luiz Augusto von Dentz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2020-02-19  0:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds the definition to BT_PHY socket options along with the
possible bitfields for the return value.
---
 lib/bluetooth.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index 756dce164..d14217eac 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -123,6 +123,24 @@ struct bt_voice {
 #define BT_VOICE_TRANSPARENT			0x0003
 #define BT_VOICE_CVSD_16BIT			0x0060
 
+#define BT_PHY			14
+
+#define BT_PHY_BR_1M_1SLOT	0x00000001
+#define BT_PHY_BR_1M_3SLOT	0x00000002
+#define BT_PHY_BR_1M_5SLOT	0x00000004
+#define BT_PHY_EDR_2M_1SLOT	0x00000008
+#define BT_PHY_EDR_2M_3SLOT	0x00000010
+#define BT_PHY_EDR_2M_5SLOT	0x00000020
+#define BT_PHY_EDR_3M_1SLOT	0x00000040
+#define BT_PHY_EDR_3M_3SLOT	0x00000080
+#define BT_PHY_EDR_3M_5SLOT	0x00000100
+#define BT_PHY_LE_1M_TX		0x00000200
+#define BT_PHY_LE_1M_RX		0x00000400
+#define BT_PHY_LE_2M_TX		0x00000800
+#define BT_PHY_LE_2M_RX		0x00001000
+#define BT_PHY_LE_CODED_TX	0x00002000
+#define BT_PHY_LE_CODED_RX	0x00004000
+
 /* Connection and socket states */
 enum {
 	BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH BlueZ 2/4] btio: Add BT_IO_PHY option
  2020-02-19  0:36 [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
@ 2020-02-19  0:36 ` Luiz Augusto von Dentz
  2020-02-19  0:36 ` [PATCH BlueZ 3/4] l2test: Add support to BT_PHY Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2020-02-19  0:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds BT_IO_PHY option which can be used to read the underline
packet types/PHY in use by the link layer.
---
 btio/btio.c | 37 ++++++++++++++++++++++++++++++++++++-
 btio/btio.h |  1 +
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/btio/btio.c b/btio/btio.c
index af2276db9..db37b99da 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -881,6 +881,7 @@ static gboolean parse_set_opts(struct set_opts *opts, GError **err,
 		case BT_IO_OPT_DEST_CHANNEL:
 		case BT_IO_OPT_HANDLE:
 		case BT_IO_OPT_CLASS:
+		case BT_IO_OPT_PHY:
 		default:
 			g_set_error(err, BT_IO_ERROR, EINVAL,
 					"Unknown option %d", opt);
@@ -968,6 +969,17 @@ static int get_priority(int sock, uint32_t *prio)
 	return 0;
 }
 
+static int get_phy(int sock, uint32_t *phy)
+{
+	socklen_t len;
+
+	len = sizeof(*phy);
+	if (getsockopt(sock, SOL_BLUETOOTH, BT_PHY, phy, &len) < 0)
+		return -errno;
+
+	return 0;
+}
+
 static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
 								va_list args)
 {
@@ -979,7 +991,7 @@ static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
 	uint16_t handle = 0;
 	socklen_t len;
 	gboolean flushable = FALSE, have_dst = FALSE;
-	uint32_t priority;
+	uint32_t priority, phy;
 
 	if (!get_src(sock, &src, sizeof(src), err))
 		return FALSE;
@@ -1147,6 +1159,13 @@ parse_opts:
 			}
 			*(va_arg(args, uint32_t *)) = priority;
 			break;
+		case BT_IO_OPT_PHY:
+			if (get_phy(sock, &phy) < 0) {
+				ERROR_FAILED(err, "get_phy", errno);
+				return FALSE;
+			}
+			*(va_arg(args, uint32_t *)) = phy;
+			break;
 		case BT_IO_OPT_INVALID:
 		case BT_IO_OPT_SOURCE_TYPE:
 		case BT_IO_OPT_CHANNEL:
@@ -1194,6 +1213,7 @@ static gboolean rfcomm_get(int sock, GError **err, BtIOOption opt1,
 	socklen_t len;
 	uint8_t dev_class[3];
 	uint16_t handle = 0;
+	uint32_t phy;
 
 	if (!get_src(sock, &src, sizeof(src), err))
 		return FALSE;
@@ -1287,6 +1307,13 @@ static gboolean rfcomm_get(int sock, GError **err, BtIOOption opt1,
 			}
 			memcpy(va_arg(args, uint8_t *), dev_class, 3);
 			break;
+		case BT_IO_OPT_PHY:
+			if (get_phy(sock, &phy) < 0) {
+				ERROR_FAILED(err, "get_phy", errno);
+				return FALSE;
+			}
+			*(va_arg(args, uint32_t *)) = phy;
+			break;
 		case BT_IO_OPT_SOURCE_TYPE:
 		case BT_IO_OPT_DEST_TYPE:
 		case BT_IO_OPT_KEY_SIZE:
@@ -1338,6 +1365,7 @@ static gboolean sco_get(int sock, GError **err, BtIOOption opt1, va_list args)
 	socklen_t len;
 	uint8_t dev_class[3];
 	uint16_t handle = 0;
+	uint32_t phy;
 
 	len = sizeof(sco_opt);
 	memset(&sco_opt, 0, len);
@@ -1385,6 +1413,13 @@ static gboolean sco_get(int sock, GError **err, BtIOOption opt1, va_list args)
 			}
 			memcpy(va_arg(args, uint8_t *), dev_class, 3);
 			break;
+		case BT_IO_OPT_PHY:
+			if (get_phy(sock, &phy) < 0) {
+				ERROR_FAILED(err, "get_phy", errno);
+				return FALSE;
+			}
+			*(va_arg(args, uint32_t *)) = phy;
+			break;
 		case BT_IO_OPT_SOURCE_TYPE:
 		case BT_IO_OPT_DEST_TYPE:
 		case BT_IO_OPT_DEFER_TIMEOUT:
diff --git a/btio/btio.h b/btio/btio.h
index 2dce9f0c1..41a017acb 100644
--- a/btio/btio.h
+++ b/btio/btio.h
@@ -56,6 +56,7 @@ typedef enum {
 	BT_IO_OPT_FLUSHABLE,
 	BT_IO_OPT_PRIORITY,
 	BT_IO_OPT_VOICE,
+	BT_IO_OPT_PHY,
 } BtIOOption;
 
 typedef enum {
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH BlueZ 3/4] l2test: Add support to BT_PHY
  2020-02-19  0:36 [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
  2020-02-19  0:36 ` [PATCH BlueZ 2/4] btio: Add BT_IO_PHY option Luiz Augusto von Dentz
@ 2020-02-19  0:36 ` Luiz Augusto von Dentz
  2020-02-19  0:36 ` [PATCH BlueZ 4/4] avdtp: Enable MTU auto tunning Luiz Augusto von Dentz
  2020-02-19 21:55 ` [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2020-02-19  0:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This makes l2test attempt to read BT_PHY socket option and print out
the supported packet types/PHY:

l2test[7282]: Connected to XX:XX:XX:XX:XX:XX (bredr, psm 4113, dcid 64)
l2test[7282]: Local device XX:XX:XX:XX:XX:XX (bredr, psm 4113, scid 64)
l2test[7282]: Options [imtu 672, omtu 672, flush_to 65535, mode 0, handle 256, class 0x000000, priority 0, rcvbuf 212992]
l2test[7282]: Supported PHY: 0x000001ff
          BR1M1SLOT
          BR1M3SLOT
          BR1M5SLOT
          EDR2M1SLOT
          EDR2M3SLOT
          EDR2M5SLOT
          EDR3M1SLOT
          EDR3M3SLOT
          EDR3M5SLOT
---
 tools/l2test.c | 209 +++++++++++++++++++++++--------------------------
 1 file changed, 96 insertions(+), 113 deletions(-)

diff --git a/tools/l2test.c b/tools/l2test.c
index e787c2ce2..8c6e08646 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -49,6 +49,7 @@
 #include "lib/l2cap.h"
 
 #include "src/shared/util.h"
+#include "monitor/display.h"
 
 #define NIBBLE_TO_ASCII(c)  ((c) < 0x0a ? (c) + 0x30 : (c) + 0x57)
 
@@ -306,14 +307,105 @@ static int setopts(int sk, struct l2cap_options *opts)
 							sizeof(opts->imtu));
 }
 
+bool use_color(void)
+{
+	return false;
+}
+
+static const struct bitfield_data phy_table[] = {
+	{  0, "BR1M1SLOT" },
+	{  1, "BR1M3SLOT" },
+	{  2, "BR1M5SLOT" },
+	{  3, "EDR2M1SLOT" },
+	{  4, "EDR2M3SLOT" },
+	{  5, "EDR2M5SLOT" },
+	{  6, "EDR3M1SLOT" },
+	{  7, "EDR3M3SLOT" },
+	{  8, "EDR3M5SLOT" },
+	{  9, "LE1MTX" },
+	{ 10, "LE1MRX" },
+	{ 11, "LE2MTX" },
+	{ 12, "LE2MRX" },
+	{ 13, "LECODEDTX" },
+	{ 14, "LECODEDRX" },
+	{},
+};
+
+static int print_info(int sk, struct l2cap_options *opts)
+{
+	struct sockaddr_l2 addr;
+	socklen_t optlen;
+	struct l2cap_conninfo conn;
+	int prio, phy;
+	char ba[18];
+
+	/* Get connection information */
+	memset(&conn, 0, sizeof(conn));
+	optlen = sizeof(conn);
+
+	if (getsockopt(sk, SOL_L2CAP, L2CAP_CONNINFO, &conn, &optlen) < 0) {
+		syslog(LOG_ERR, "Can't get L2CAP connection information: "
+				"%s (%d)", strerror(errno), errno);
+		return -errno;
+	}
+
+	if (getsockopt(sk, SOL_SOCKET, SO_PRIORITY, &prio, &optlen) < 0) {
+		syslog(LOG_ERR, "Can't get socket priority: %s (%d)",
+							strerror(errno), errno);
+		return -errno;
+	}
+
+	/* Check for remote address */
+	memset(&addr, 0, sizeof(addr));
+	optlen = sizeof(addr);
+
+	if (getpeername(sk, (struct sockaddr *) &addr, &optlen) < 0) {
+		syslog(LOG_ERR, "Can't get socket name: %s (%d)",
+							strerror(errno), errno);
+		return -errno;
+	}
+
+	ba2str(&addr.l2_bdaddr, ba);
+	syslog(LOG_INFO, "Connected to %s (%s, psm %d, dcid %d)", ba,
+		get_lookup_str(bdaddr_types, addr.l2_bdaddr_type),
+		addr.l2_psm, addr.l2_cid);
+
+	/* Check for socket address */
+	memset(&addr, 0, sizeof(addr));
+	optlen = sizeof(addr);
+
+	if (getsockname(sk, (struct sockaddr *) &addr, &optlen) < 0) {
+		syslog(LOG_ERR, "Can't get socket name: %s (%d)",
+							strerror(errno), errno);
+		return -errno;
+	}
+
+	ba2str(&addr.l2_bdaddr, ba);
+	syslog(LOG_INFO, "Local device %s (%s, psm %d, scid %d)", ba,
+		get_lookup_str(bdaddr_types, addr.l2_bdaddr_type),
+		addr.l2_psm, addr.l2_cid);
+
+	syslog(LOG_INFO, "Options [imtu %d, omtu %d, flush_to %d, mode %d, "
+		"handle %d, class 0x%02x%02x%02x, priority %d, rcvbuf %d]",
+		opts->imtu, opts->omtu, opts->flush_to, opts->mode,
+		conn.hci_handle, conn.dev_class[2], conn.dev_class[1],
+		conn.dev_class[0], prio, rcvbuf);
+
+
+	if (!getsockopt(sk, SOL_BLUETOOTH, BT_PHY, &phy, &optlen)) {
+		syslog(LOG_INFO, "Supported PHY: 0x%08x", phy);
+		print_bitfield(2, phy, phy_table);
+	}
+
+	return 0;
+}
+
 static int do_connect(char *svr)
 {
 	struct sockaddr_l2 addr;
 	struct l2cap_options opts;
-	struct l2cap_conninfo conn;
 	socklen_t optlen;
 	int sk, opt;
-	char ba[18];
 
 	/* Create socket */
 	sk = socket(PF_BLUETOOTH, socktype, BTPROTO_L2CAP);
@@ -451,64 +543,8 @@ static int do_connect(char *svr)
 		goto error;
 	}
 
-	/* Get connection information */
-	memset(&conn, 0, sizeof(conn));
-	optlen = sizeof(conn);
-
-	if (getsockopt(sk, SOL_L2CAP, L2CAP_CONNINFO, &conn, &optlen) < 0) {
-		syslog(LOG_ERR, "Can't get L2CAP connection information: %s (%d)",
-							strerror(errno), errno);
-		goto error;
-	}
-
-	if (priority > 0 && setsockopt(sk, SOL_SOCKET, SO_PRIORITY, &priority,
-						sizeof(priority)) < 0) {
-		syslog(LOG_ERR, "Can't set socket priority: %s (%d)",
-							strerror(errno), errno);
-		goto error;
-	}
-
-	if (getsockopt(sk, SOL_SOCKET, SO_PRIORITY, &opt, &optlen) < 0) {
-		syslog(LOG_ERR, "Can't get socket priority: %s (%d)",
-							strerror(errno), errno);
-		goto error;
-	}
-
-	/* Check for remote address */
-	memset(&addr, 0, sizeof(addr));
-	optlen = sizeof(addr);
-
-	if (getpeername(sk, (struct sockaddr *) &addr, &optlen) < 0) {
-		syslog(LOG_ERR, "Can't get socket name: %s (%d)",
-							strerror(errno), errno);
-		goto error;
-	}
-
-	ba2str(&addr.l2_bdaddr, ba);
-	syslog(LOG_INFO, "Connected to %s (%s, psm %d, scid %d)", ba,
-		get_lookup_str(bdaddr_types, addr.l2_bdaddr_type),
-		addr.l2_psm, addr.l2_cid);
-
-	/* Check for socket address */
-	memset(&addr, 0, sizeof(addr));
-	optlen = sizeof(addr);
-
-	if (getsockname(sk, (struct sockaddr *) &addr, &optlen) < 0) {
-		syslog(LOG_ERR, "Can't get socket name: %s (%d)",
-							strerror(errno), errno);
+	if (print_info(sk, &opts) < 0)
 		goto error;
-	}
-
-	ba2str(&addr.l2_bdaddr, ba);
-	syslog(LOG_INFO, "Local device %s (%s, psm %d, scid %d)", ba,
-		get_lookup_str(bdaddr_types, addr.l2_bdaddr_type),
-		addr.l2_psm, addr.l2_cid);
-
-	syslog(LOG_INFO, "Options [imtu %d, omtu %d, flush_to %d, "
-		"mode %d, handle %d, class 0x%02x%02x%02x, priority %d, rcvbuf %d]",
-		opts.imtu, opts.omtu, opts.flush_to, opts.mode, conn.hci_handle,
-		conn.dev_class[2], conn.dev_class[1], conn.dev_class[0], opt,
-		rcvbuf);
 
 	omtu = (opts.omtu > buffer_size) ? buffer_size : opts.omtu;
 	imtu = (opts.imtu > buffer_size) ? buffer_size : opts.imtu;
@@ -524,10 +560,8 @@ static void do_listen(void (*handler)(int sk))
 {
 	struct sockaddr_l2 addr;
 	struct l2cap_options opts;
-	struct l2cap_conninfo conn;
 	socklen_t optlen;
 	int sk, nsk, opt;
-	char ba[18];
 
 	/* Create socket */
 	sk = socket(PF_BLUETOOTH, socktype, BTPROTO_L2CAP);
@@ -677,62 +711,11 @@ static void do_listen(void (*handler)(int sk))
 			}
 		}
 
-		/* Get connection information */
-		memset(&conn, 0, sizeof(conn));
-		optlen = sizeof(conn);
-
-		if (getsockopt(nsk, SOL_L2CAP, L2CAP_CONNINFO, &conn, &optlen) < 0) {
-			syslog(LOG_ERR, "Can't get L2CAP connection information: %s (%d)",
-							strerror(errno), errno);
-			if (!defer_setup) {
-				close(nsk);
-				goto error;
-			}
-		}
-
-		if (priority > 0 && setsockopt(nsk, SOL_SOCKET, SO_PRIORITY,
-					&priority, sizeof(priority)) < 0) {
-			syslog(LOG_ERR, "Can't set socket priority: %s (%d)",
-						strerror(errno), errno);
+		if (print_info(nsk, &opts) < 0) {
 			close(nsk);
 			goto error;
 		}
 
-		optlen = sizeof(priority);
-		if (getsockopt(nsk, SOL_SOCKET, SO_PRIORITY, &opt, &optlen) < 0) {
-			syslog(LOG_ERR, "Can't get socket priority: %s (%d)",
-							strerror(errno), errno);
-			goto error;
-		}
-
-		ba2str(&addr.l2_bdaddr, ba);
-		syslog(LOG_INFO, "Connect from %s (%s, psm %d, dcid %d)", ba,
-				get_lookup_str(bdaddr_types, addr.l2_bdaddr_type),
-				addr.l2_psm, addr.l2_cid);
-
-		/* Check for socket address */
-		memset(&addr, 0, sizeof(addr));
-		optlen = sizeof(addr);
-
-		if (getsockname(nsk, (struct sockaddr *) &addr, &optlen) < 0) {
-			syslog(LOG_ERR, "Can't get socket name: %s (%d)",
-							strerror(errno), errno);
-			goto error;
-		}
-
-		ba2str(&addr.l2_bdaddr, ba);
-		syslog(LOG_INFO, "Local device %s (%s, psm %d, scid %d)", ba,
-				get_lookup_str(bdaddr_types, addr.l2_bdaddr_type),
-				addr.l2_psm, addr.l2_cid);
-
-		syslog(LOG_INFO, "Options [imtu %d, omtu %d, "
-				"flush_to %d, mode %d, handle %d, "
-				"class 0x%02x%02x%02x, priority %d, rcvbuf %d]",
-				opts.imtu, opts.omtu, opts.flush_to,
-				opts.mode, conn.hci_handle, conn.dev_class[2],
-				conn.dev_class[1], conn.dev_class[0], opt,
-				rcvbuf);
-
 		omtu = (opts.omtu > buffer_size) ? buffer_size : opts.omtu;
 		imtu = (opts.imtu > buffer_size) ? buffer_size : opts.imtu;
 
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH BlueZ 4/4] avdtp: Enable MTU auto tunning
  2020-02-19  0:36 [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
  2020-02-19  0:36 ` [PATCH BlueZ 2/4] btio: Add BT_IO_PHY option Luiz Augusto von Dentz
  2020-02-19  0:36 ` [PATCH BlueZ 3/4] l2test: Add support to BT_PHY Luiz Augusto von Dentz
@ 2020-02-19  0:36 ` Luiz Augusto von Dentz
  2020-02-19 21:55 ` [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2020-02-19  0:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This uses BT_PHY to check if kernel is able to do MTU auto tunning
which is enabled by forcing the input MTU to 0.
---
 profiles/audio/avdtp.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index f42f21bbb..0e075f9ff 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -401,6 +401,7 @@ struct avdtp {
 
 	struct avdtp_stream *pending_open;
 
+	uint32_t phy;
 	uint16_t imtu;
 	uint16_t omtu;
 
@@ -2291,6 +2292,9 @@ static void avdtp_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
 	if (!session->io)
 		session->io = g_io_channel_ref(chan);
 
+	/* Check if kernel supports reading packet types */
+	bt_io_get(chan, NULL, BT_IO_OPT_PHY, &session->phy, BT_IO_OPT_INVALID);
+
 	bt_io_get(chan, &err,
 			BT_IO_OPT_OMTU, &session->omtu,
 			BT_IO_OPT_IMTU, &session->imtu,
@@ -2399,14 +2403,26 @@ static GIOChannel *l2cap_connect(struct avdtp *session)
 
 	src = btd_adapter_get_address(device_get_adapter(session->device));
 
-	io = bt_io_connect(avdtp_connect_cb, session,
-				NULL, &err,
-				BT_IO_OPT_SOURCE_BDADDR, src,
-				BT_IO_OPT_DEST_BDADDR,
-				device_get_address(session->device),
-				BT_IO_OPT_PSM, AVDTP_PSM,
-				BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
-				BT_IO_OPT_INVALID);
+	if (session->phy)
+		io = bt_io_connect(avdtp_connect_cb, session,
+					NULL, &err,
+					BT_IO_OPT_SOURCE_BDADDR, src,
+					BT_IO_OPT_DEST_BDADDR,
+					device_get_address(session->device),
+					BT_IO_OPT_PSM, AVDTP_PSM,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
+					/* Set Input MTU to 0 to auto-tune */
+					BT_IO_OPT_IMTU, 0,
+					BT_IO_OPT_INVALID);
+	else
+		io = bt_io_connect(avdtp_connect_cb, session,
+					NULL, &err,
+					BT_IO_OPT_SOURCE_BDADDR, src,
+					BT_IO_OPT_DEST_BDADDR,
+					device_get_address(session->device),
+					BT_IO_OPT_PSM, AVDTP_PSM,
+					BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM,
+					BT_IO_OPT_INVALID);
 	if (!io) {
 		error("%s", err->message);
 		g_error_free(err);
-- 
2.21.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH BlueZ 1/4] lib: Add definition to BT_PHY
  2020-02-19  0:36 [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2020-02-19  0:36 ` [PATCH BlueZ 4/4] avdtp: Enable MTU auto tunning Luiz Augusto von Dentz
@ 2020-02-19 21:55 ` Luiz Augusto von Dentz
  3 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2020-02-19 21:55 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org

Hi,

On Tue, Feb 18, 2020 at 4:36 PM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This adds the definition to BT_PHY socket options along with the
> possible bitfields for the return value.
> ---
>  lib/bluetooth.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/lib/bluetooth.h b/lib/bluetooth.h
> index 756dce164..d14217eac 100644
> --- a/lib/bluetooth.h
> +++ b/lib/bluetooth.h
> @@ -123,6 +123,24 @@ struct bt_voice {
>  #define BT_VOICE_TRANSPARENT                   0x0003
>  #define BT_VOICE_CVSD_16BIT                    0x0060
>
> +#define BT_PHY                 14
> +
> +#define BT_PHY_BR_1M_1SLOT     0x00000001
> +#define BT_PHY_BR_1M_3SLOT     0x00000002
> +#define BT_PHY_BR_1M_5SLOT     0x00000004
> +#define BT_PHY_EDR_2M_1SLOT    0x00000008
> +#define BT_PHY_EDR_2M_3SLOT    0x00000010
> +#define BT_PHY_EDR_2M_5SLOT    0x00000020
> +#define BT_PHY_EDR_3M_1SLOT    0x00000040
> +#define BT_PHY_EDR_3M_3SLOT    0x00000080
> +#define BT_PHY_EDR_3M_5SLOT    0x00000100
> +#define BT_PHY_LE_1M_TX                0x00000200
> +#define BT_PHY_LE_1M_RX                0x00000400
> +#define BT_PHY_LE_2M_TX                0x00000800
> +#define BT_PHY_LE_2M_RX                0x00001000
> +#define BT_PHY_LE_CODED_TX     0x00002000
> +#define BT_PHY_LE_CODED_RX     0x00004000
> +
>  /* Connection and socket states */
>  enum {
>         BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
> --
> 2.21.1

Pushed.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-19 21:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-19  0:36 [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz
2020-02-19  0:36 ` [PATCH BlueZ 2/4] btio: Add BT_IO_PHY option Luiz Augusto von Dentz
2020-02-19  0:36 ` [PATCH BlueZ 3/4] l2test: Add support to BT_PHY Luiz Augusto von Dentz
2020-02-19  0:36 ` [PATCH BlueZ 4/4] avdtp: Enable MTU auto tunning Luiz Augusto von Dentz
2020-02-19 21:55 ` [PATCH BlueZ 1/4] lib: Add definition to BT_PHY Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox