linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions
@ 2011-10-28  0:28 Peter Krystad
  2011-10-28  0:28 ` [PATCH v2 bluez 1/2] Add L2CAP Create/Move Channel definitions Peter Krystad
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Krystad @ 2011-10-28  0:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Peter Krystad

This patchset adds BT 3.0+HS signalling definitions

v2 - Use A2MP/a2mp nomenclature

Peter Krystad (2):
  Add L2CAP Create/Move Channel definitions
  Add A2MP definitions

 lib/a2mp.h  |  133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/l2cap.h |   44 +++++++++++++++++++
 2 files changed, 177 insertions(+), 0 deletions(-)
 create mode 100644 lib/a2mp.h

-- 
1.7.7

-- 
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

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

* [PATCH v2 bluez 1/2] Add L2CAP Create/Move Channel definitions
  2011-10-28  0:28 [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Peter Krystad
@ 2011-10-28  0:28 ` Peter Krystad
  2011-10-28  0:28 ` [PATCH v2 bluez 2/2] Add A2MP definitions Peter Krystad
  2011-10-28 11:17 ` [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Andrei Emeltchenko
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Krystad @ 2011-10-28  0:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Peter Krystad

---
 lib/l2cap.h |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/lib/l2cap.h b/lib/l2cap.h
index 68593d3..6cacc98 100644
--- a/lib/l2cap.h
+++ b/lib/l2cap.h
@@ -82,6 +82,12 @@ struct l2cap_conninfo {
 #define L2CAP_ECHO_RSP		0x09
 #define L2CAP_INFO_REQ		0x0a
 #define L2CAP_INFO_RSP		0x0b
+#define L2CAP_CREATE_REQ	0x0c
+#define L2CAP_CREATE_RSP	0x0d
+#define L2CAP_MOVE_REQ		0x0e
+#define L2CAP_MOVE_RSP		0x0f
+#define L2CAP_MOVE_CFM		0x10
+#define L2CAP_MOVE_CFM_RSP	0x11
 
 /* L2CAP extended feature mask */
 #define L2CAP_FEAT_FLOWCTL	0x00000001
@@ -226,6 +232,44 @@ typedef struct {
 #define L2CAP_IR_SUCCESS	0x0000
 #define L2CAP_IR_NOTSUPP	0x0001
 
+typedef struct {
+	uint16_t	psm;
+	uint16_t	scid;
+	uint8_t		id;
+} __attribute__ ((packed)) l2cap_create_req;
+#define L2CAP_CREATE_REQ_SIZE 5
+
+typedef struct {
+	uint16_t	dcid;
+	uint16_t	scid;
+	uint16_t	result;
+	uint16_t	status;
+} __attribute__ ((packed)) l2cap_create_rsp;
+#define L2CAP_CREATE_RSP_SIZE 8
+
+typedef struct {
+	uint16_t	icid;
+	uint8_t		id;
+} __attribute__ ((packed)) l2cap_move_req;
+#define L2CAP_MOVE_REQ_SIZE 3
+
+typedef struct {
+	uint16_t	icid;
+	uint16_t	result;
+} __attribute__ ((packed)) l2cap_move_rsp;
+#define L2CAP_MOVE_RSP_SIZE 4
+
+typedef struct {
+	uint16_t	icid;
+	uint16_t	result;
+} __attribute__ ((packed)) l2cap_move_cfm;
+#define L2CAP_MOVE_CFM_SIZE 4
+
+typedef struct {
+	uint16_t	icid;
+} __attribute__ ((packed)) l2cap_move_cfm_rsp;
+#define L2CAP_MOVE_CFM_RSP_SIZE 2
+
 #ifdef __cplusplus
 }
 #endif
-- 
1.7.7

-- 
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

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

* [PATCH v2 bluez 2/2] Add A2MP definitions
  2011-10-28  0:28 [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Peter Krystad
  2011-10-28  0:28 ` [PATCH v2 bluez 1/2] Add L2CAP Create/Move Channel definitions Peter Krystad
@ 2011-10-28  0:28 ` Peter Krystad
  2011-10-28 12:22   ` Johan Hedberg
  2011-10-28 11:17 ` [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Andrei Emeltchenko
  2 siblings, 1 reply; 6+ messages in thread
From: Peter Krystad @ 2011-10-28  0:28 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Peter Krystad

---
 lib/a2mp.h |  133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)
 create mode 100644 lib/a2mp.h

diff --git a/lib/a2mp.h b/lib/a2mp.h
new file mode 100644
index 0000000..bac55c9
--- /dev/null
+++ b/lib/a2mp.h
@@ -0,0 +1,133 @@
+/*
+ *
+ *	BlueZ - Bluetooth protocol stack for Linux
+ *
+ *	Copyright (C) 2010-2011 Code Aurora Forum.  All rights reserved.
+ *
+ *	This program is free software; you can redistribute it and/or modify
+ *	it under the terms of the GNU General Public License version 2 and
+ *	only version 2 as published by the Free Software Foundation.
+ *
+ *	This program is distributed in the hope that it will be useful,
+ *	but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *	GNU General Public License for more details.
+ *
+ */
+
+#ifndef __A2MP_H
+#define __A2MP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* A2MP Protocol */
+
+/* A2MP command codes */
+
+#define A2MP_COMMAND_REJ	0x01
+#define A2MP_DISCOVER_REQ	0x02
+#define A2MP_DISCOVER_RSP	0x03
+#define A2MP_CHANGE_NOTIFY	0x04
+#define A2MP_CHANGE_RSP		0x05
+#define A2MP_INFO_REQ		0x06
+#define A2MP_INFO_RSP		0x07
+#define A2MP_ASSOC_REQ		0x08
+#define A2MP_ASSOC_RSP		0x09
+#define A2MP_CREATE_REQ		0x0a
+#define A2MP_CREATE_RSP		0x0b
+#define A2MP_DISCONN_REQ	0x0c
+#define A2MP_DISCONN_RSP	0x0d
+
+typedef struct {
+	uint8_t		code;
+	uint8_t		ident;
+	uint16_t	len;
+} __attribute__ ((packed)) a2mp_hdr;
+#define A2MP_HDR_SIZE 4
+
+typedef struct {
+	uint8_t		type_id;
+	uint16_t	len;
+	uint8_t		data[0];
+} __attribute__ ((packed)) a2mp_assoc_tlv;
+
+typedef struct {
+	uint16_t	reason;
+} __attribute__ ((packed)) a2mp_cmd_rej_parms;
+
+typedef struct {
+	uint16_t	mtu;
+	uint16_t	mask;
+} __attribute__ ((packed)) a2mp_discover_req_parms;
+
+typedef struct {
+	uint16_t	mtu;
+	uint16_t	mask;
+	uint8_t		controller_list[0];
+} __attribute__ ((packed)) a2mp_discover_rsp_parms;
+
+typedef struct {
+	uint8_t		id;
+} __attribute__ ((packed)) a2mp_info_req_parms;
+
+typedef struct {
+	uint8_t		id;
+	uint8_t		status;
+	uint32_t	total_bandwidth;
+	uint32_t	max_bandwidth;
+	uint32_t	min_latency;
+	uint16_t	pal_caps;
+	uint16_t	assoc_size;
+} __attribute__ ((packed)) a2mp_info_rsp_parms;
+
+typedef struct {
+	uint8_t		id;
+	uint8_t		status;
+	a2mp_assoc_tlv	assoc;
+} __attribute__ ((packed)) a2mp_assoc_rsp_parms;
+
+typedef struct {
+	uint8_t		local_id;
+	uint8_t		remote_id;
+	a2mp_assoc_tlv	assoc;
+} __attribute__ ((packed)) a2mp_create_req_parms;
+
+typedef struct {
+	uint8_t		local_id;
+	uint8_t		remote_id;
+	uint8_t		status;
+} __attribute__ ((packed)) a2mp_create_rsp_parms;
+
+typedef struct {
+	uint8_t		local_id;
+	uint8_t		remote_id;
+} __attribute__ ((packed)) a2mp_disconn_req_parms;
+
+#define A2MP_COMMAND_NOT_RECOGNIZED 0x0000
+
+/* AMP controller status */
+#define AMP_CTRL_POWERED_DOWN		0x00
+#define AMP_CTRL_BLUETOOTH_ONLY		0x01
+#define AMP_CTRL_NO_CAPACITY		0x02
+#define AMP_CTRL_LOW_CAPACITY		0x03
+#define AMP_CTRL_MEDIUM_CAPACITY	0x04
+#define AMP_CTRL_HIGH_CAPACITY		0x05
+#define AMP_CTRL_FULL_CAPACITY		0x06
+
+/* A2MP response status */
+#define A2MP_STATUS_SUCCESS				0x00
+#define A2MP_STATUS_INVALID_CTRL_ID			0x01
+#define A2MP_STATUS_UNABLE_START_LINK_CREATION		0x02
+#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS		0x02
+#define A2MP_STATUS_COLLISION_OCCURED			0x03
+#define A2MP_STATUS_DISCONN_REQ_RECVD			0x04
+#define A2MP_STATUS_PHYS_LINK_EXISTS			0x05
+#define A2MP_STATUS_SECURITY_VIOLATION			0x06
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __A2MP_H */
-- 
1.7.7

-- 
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

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

* Re: [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions
  2011-10-28  0:28 [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Peter Krystad
  2011-10-28  0:28 ` [PATCH v2 bluez 1/2] Add L2CAP Create/Move Channel definitions Peter Krystad
  2011-10-28  0:28 ` [PATCH v2 bluez 2/2] Add A2MP definitions Peter Krystad
@ 2011-10-28 11:17 ` Andrei Emeltchenko
  2 siblings, 0 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2011-10-28 11:17 UTC (permalink / raw)
  To: Peter Krystad; +Cc: linux-bluetooth

On Thu, Oct 27, 2011 at 05:28:37PM -0700, Peter Krystad wrote:
> This patchset adds BT 3.0+HS signalling definitions
> 
> v2 - Use A2MP/a2mp nomenclature
> 
> Peter Krystad (2):
>   Add L2CAP Create/Move Channel definitions
>   Add A2MP definitions
> 
>  lib/a2mp.h  |  133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  lib/l2cap.h |   44 +++++++++++++++++++
>  2 files changed, 177 insertions(+), 0 deletions(-)
>  create mode 100644 lib/a2mp.h

ack (taking that typedef is a bluez standard way)

Best regards 
Andrei Emeltchenko 


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

* Re: [PATCH v2 bluez 2/2] Add A2MP definitions
  2011-10-28  0:28 ` [PATCH v2 bluez 2/2] Add A2MP definitions Peter Krystad
@ 2011-10-28 12:22   ` Johan Hedberg
  2011-10-28 21:04     ` Peter Krystad
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Hedberg @ 2011-10-28 12:22 UTC (permalink / raw)
  To: Peter Krystad; +Cc: linux-bluetooth

Hi Peter,

On Thu, Oct 27, 2011, Peter Krystad wrote:
> +typedef struct {
> +	uint8_t		code;
> +	uint8_t		ident;
> +	uint16_t	len;
> +} __attribute__ ((packed)) a2mp_hdr;

Even though the legacy user space code uses typedefs for HCI and L2CAP
(which is why typedefs are probably ok for your 1st patch) the general
direction should be to try to get rid of them where they're not strictly
necessary. The kernel side headers don't use them either (take a look at
include/net/bluetooth/l2cap.h and hci.h).

Therefore, I think it'd be good if you'd from the start avoid them in
this a2mp code. Later it'd be good to have a cleanup patch to convert
the L2CAP and HCI definitions to not use them either.

Johan

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

* RE: [PATCH v2 bluez 2/2] Add A2MP definitions
  2011-10-28 12:22   ` Johan Hedberg
@ 2011-10-28 21:04     ` Peter Krystad
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Krystad @ 2011-10-28 21:04 UTC (permalink / raw)
  To: 'Johan Hedberg'; +Cc: linux-bluetooth

Hi Johan,
 
> Therefore, I think it'd be good if you'd from the start avoid them in
> this a2mp code. Later it'd be good to have a cleanup patch to convert
> the L2CAP and HCI definitions to not use them either.
> 
> Johan

I'll drop the typedefs and resend.

Peter.

--Peter Krystad
  Employee of Qualcomm Innovation Center, Inc.
  Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum


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

end of thread, other threads:[~2011-10-28 21:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28  0:28 [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Peter Krystad
2011-10-28  0:28 ` [PATCH v2 bluez 1/2] Add L2CAP Create/Move Channel definitions Peter Krystad
2011-10-28  0:28 ` [PATCH v2 bluez 2/2] Add A2MP definitions Peter Krystad
2011-10-28 12:22   ` Johan Hedberg
2011-10-28 21:04     ` Peter Krystad
2011-10-28 11:17 ` [PATCH v2 bluez 0/2] Add BT 3.0+HS definitions Andrei Emeltchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).