Linux bluetooth development
 help / color / mirror / Atom feed
* RE: BUG in Mobile initiated pairing
From: sachin.athanikar @ 2011-02-17 14:40 UTC (permalink / raw)
  To: padovan; +Cc: linux-bluetooth
In-Reply-To: <20110217130322.GA10543@joana>

Hi Gustavo,
Many thanks for the response.

The property changed event "Paired" is not generated when the mobile initiated pairing is successful. So I am not able get an acknowledgement for successful completion of pairing process.

Thanks
Sachin

-----Original Message-----
From: Gustavo F. Padovan [mailto:pao@profusion.mobi] On Behalf Of Gustavo F. Padovan
Sent: Thursday, February 17, 2011 6:33 PM
To: Athanikar, Sachin
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: BUG in Mobile initiated pairing

HI Sachin,

* sachin.athanikar@accenture.com <sachin.athanikar@accenture.com> [2011-02-17 14:17:47 +0530]:

> Hi Gustavo,
>
> I have a question on pairing.
>
> Is standard pairing working fine in BlueZ with all necessary events being generated?
>
> I am using blueZ 4.88 on Ubuntu 10.10.
>
> Adapter initiated pairing:
> -------------------------
> I am using agent.c which is part of test folder of BlueZ code base.
> Agent.c is used for adapter initiated pairing where I am able to get the response and event from BlueZ (observed in DBUS monitor).
>
>
> Mobile Phone initiated pairing:
> ------------------------------------------
> I have modified the agent.c in test folder of BlueZ to accept the mobile initiated pairing request.
>
> When the pairing is initiated from Mobile phone, after the successful pairing, the property changed event for "Paired" is not generated. And even the agent is not released.

The "Paired" is generated, and not releasing the agent is the usual behaviour
for this case.

--
Gustavo F. Padovan
http://profusion.mobi


This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

^ permalink raw reply

* Re: [PATCH 07/10] Bluetooth: Fix code style issues and make checkpatch silent about hci_core.h
From: Gustavo F. Padovan @ 2011-02-17 14:43 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
In-Reply-To: <1297948601-12723-8-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

* Szymon Janc <szymon.janc@tieto.com> [2011-02-17 14:16:38 +0100]:

> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
>  include/net/bluetooth/hci_core.h |   91 +++++++++++++++++++++-----------------
>  1 files changed, 51 insertions(+), 40 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index e4f370f..a8a5ecb 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -208,37 +208,37 @@ struct hci_dev {
>  struct hci_conn {
>  	struct list_head list;
>  
> -	atomic_t	 refcnt;
> -	spinlock_t	 lock;
> -
> -	bdaddr_t	 dst;
> -	__u16		 handle;
> -	__u16		 state;
> -	__u8             mode;
> -	__u8		 type;
> -	__u8		 out;
> -	__u8		 attempt;
> -	__u8		 dev_class[3];
> -	__u8             features[8];
> -	__u8             ssp_mode;
> -	__u16            interval;
> -	__u16            pkt_type;
> -	__u16            link_policy;
> -	__u32		 link_mode;
> -	__u8             auth_type;
> -	__u8             sec_level;
> -	__u8		 pending_sec_level;
> -	__u8		 pin_length;
> -	__u8		 io_capability;
> -	__u8             power_save;
> -	__u16            disc_timeout;
> -	unsigned long	 pend;
> +	atomic_t	refcnt;
> +	spinlock_t	lock;
> +
> +	bdaddr_t	dst;
> +	__u16		handle;
> +	__u16		state;
> +	__u8		mode;
> +	__u8		type;
> +	__u8		out;
> +	__u8		attempt;
> +	__u8		dev_class[3];
> +	__u8		features[8];
> +	__u8		ssp_mode;
> +	__u16		interval;
> +	__u16		pkt_type;
> +	__u16		link_policy;
> +	__u32		link_mode;
> +	__u8		auth_type;
> +	__u8		sec_level;
> +	__u8		pending_sec_level;
> +	__u8		pin_length;
> +	__u8		io_capability;
> +	__u8		power_save;
> +	__u16		disc_timeout;
> +	unsigned long	pend;
>  
>  	__u8		remote_cap;
>  	__u8		remote_oob;
>  	__u8		remote_auth;
>  
> -	unsigned int	 sent;
> +	unsigned int	sent;
>  
>  	struct sk_buff_head data_q;
>  
> @@ -298,7 +298,8 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
>  	return jiffies - e->timestamp;
>  }
>  
> -struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
> +struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev,
> +							bdaddr_t *bdaddr);

Leave the line over 80 fix out of this patches, I'm not sure if I want to fix
that now.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* [PATCH v2] Bluetooth: Fix some code style issues in hci_core.h
From: Szymon Janc @ 2011-02-17 15:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: par-gunnar.p.hjalmdahl, henrik.possung, Szymon Janc
In-Reply-To: <20110217144340.GE10543@joana>

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
 include/net/bluetooth/hci_core.h |   58 +++++++++++++++++++-------------------
 1 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e4f370f..2893288 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -208,37 +208,37 @@ struct hci_dev {
 struct hci_conn {
 	struct list_head list;
 
-	atomic_t	 refcnt;
-	spinlock_t	 lock;
-
-	bdaddr_t	 dst;
-	__u16		 handle;
-	__u16		 state;
-	__u8             mode;
-	__u8		 type;
-	__u8		 out;
-	__u8		 attempt;
-	__u8		 dev_class[3];
-	__u8             features[8];
-	__u8             ssp_mode;
-	__u16            interval;
-	__u16            pkt_type;
-	__u16            link_policy;
-	__u32		 link_mode;
-	__u8             auth_type;
-	__u8             sec_level;
-	__u8		 pending_sec_level;
-	__u8		 pin_length;
-	__u8		 io_capability;
-	__u8             power_save;
-	__u16            disc_timeout;
-	unsigned long	 pend;
+	atomic_t	refcnt;
+	spinlock_t	lock;
+
+	bdaddr_t	dst;
+	__u16		handle;
+	__u16		state;
+	__u8		mode;
+	__u8		type;
+	__u8		out;
+	__u8		attempt;
+	__u8		dev_class[3];
+	__u8		features[8];
+	__u8		ssp_mode;
+	__u16		interval;
+	__u16		pkt_type;
+	__u16		link_policy;
+	__u32		link_mode;
+	__u8		auth_type;
+	__u8		sec_level;
+	__u8		pending_sec_level;
+	__u8		pin_length;
+	__u8		io_capability;
+	__u8		power_save;
+	__u16		disc_timeout;
+	unsigned long	pend;
 
 	__u8		remote_cap;
 	__u8		remote_oob;
 	__u8		remote_auth;
 
-	unsigned int	 sent;
+	unsigned int	sent;
 
 	struct sk_buff_head data_q;
 
@@ -356,7 +356,7 @@ static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
-					__u16 handle)
+								__u16 handle)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct list_head *p;
@@ -371,7 +371,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
-					__u8 type, bdaddr_t *ba)
+							__u8 type, bdaddr_t *ba)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct list_head *p;
@@ -386,7 +386,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
 }
 
 static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
-					__u8 type, __u16 state)
+							__u8 type, __u16 state)
 {
 	struct hci_conn_hash *h = &hdev->conn_hash;
 	struct list_head *p;
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH v2] Bluetooth: Fix some code style issues in hci_event.c
From: Szymon Janc @ 2011-02-17 15:44 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: par-gunnar.p.hjalmdahl, henrik.possung, Szymon Janc
In-Reply-To: <1297948601-12723-10-git-send-email-szymon.janc@tieto.com>

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
 net/bluetooth/hci_event.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b39c9bb..a7c7349 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -949,7 +949,7 @@ static void hci_cs_set_conn_encrypt(struct hci_dev *hdev, __u8 status)
 }
 
 static int hci_outgoing_auth_needed(struct hci_dev *hdev,
-						struct hci_conn *conn)
+							struct hci_conn *conn)
 {
 	if (conn->state != BT_CONFIG || !conn->out)
 		return 0;
@@ -1304,7 +1304,8 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
 
 	mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type);
 
-	if ((mask & HCI_LM_ACCEPT) && !hci_blacklist_lookup(hdev, &ev->bdaddr)) {
+	if ((mask & HCI_LM_ACCEPT) &&
+			!hci_blacklist_lookup(hdev, &ev->bdaddr)) {
 		/* Connection accepted */
 		struct inquiry_entry *ie;
 		struct hci_conn *conn;
@@ -2116,7 +2117,8 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
 	hci_dev_lock(hdev);
 
 	if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) {
-		struct inquiry_info_with_rssi_and_pscan_mode *info = (void *) (skb->data + 1);
+		struct inquiry_info_with_rssi_and_pscan_mode *info;
+		info = (void *) (skb->data + 1);
 
 		for (; num_rsp; num_rsp--) {
 			bacpy(&data.bdaddr, &info->bdaddr);
@@ -2276,12 +2278,12 @@ static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct
 
 	for (; num_rsp; num_rsp--) {
 		bacpy(&data.bdaddr, &info->bdaddr);
-		data.pscan_rep_mode     = info->pscan_rep_mode;
-		data.pscan_period_mode  = info->pscan_period_mode;
-		data.pscan_mode         = 0x00;
+		data.pscan_rep_mode	= info->pscan_rep_mode;
+		data.pscan_period_mode	= info->pscan_period_mode;
+		data.pscan_mode		= 0x00;
 		memcpy(data.dev_class, info->dev_class, 3);
-		data.clock_offset       = info->clock_offset;
-		data.rssi               = info->rssi;
+		data.clock_offset	= info->clock_offset;
+		data.rssi		= info->rssi;
 		data.ssp_mode		= 0x01;
 		info++;
 		hci_inquiry_cache_update(hdev, &data);
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH v2] Bluetooth: Fix some code style issues in hci_core.c
From: Szymon Janc @ 2011-02-17 15:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: par-gunnar.p.hjalmdahl, henrik.possung, Szymon Janc
In-Reply-To: <1297948601-12723-9-git-send-email-szymon.janc@tieto.com>

Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
 net/bluetooth/hci_core.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 0f5bbb0..a1d2263 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -124,7 +124,7 @@ static void hci_req_cancel(struct hci_dev *hdev, int err)
 
 /* Execute request and wait for completion. */
 static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt),
-				unsigned long opt, __u32 timeout)
+					unsigned long opt, __u32 timeout)
 {
 	DECLARE_WAITQUEUE(wait, current);
 	int err = 0;
@@ -166,7 +166,7 @@ static int __hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev,
 }
 
 static inline int hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *hdev, unsigned long opt),
-				unsigned long opt, __u32 timeout)
+					unsigned long opt, __u32 timeout)
 {
 	int ret;
 
@@ -465,7 +465,7 @@ int hci_inquiry(void __user *arg)
 	/* cache_dump can't sleep. Therefore we allocate temp buffer and then
 	 * copy it to the user space.
 	 */
-	buf = kmalloc(sizeof(struct inquiry_info) *max_rsp, GFP_KERNEL);
+	buf = kmalloc(sizeof(struct inquiry_info) * max_rsp, GFP_KERNEL);
 	if (!buf) {
 		err = -ENOMEM;
 		goto done;
@@ -534,7 +534,6 @@ int hci_dev_open(__u16 dev)
 		set_bit(HCI_INIT, &hdev->flags);
 		hdev->init_last_cmd = 0;
 
-		//__hci_request(hdev, hci_reset_req, 0, HZ);
 		ret = __hci_request(hdev, hci_init_req, 0,
 					msecs_to_jiffies(HCI_INIT_TIMEOUT));
 
-- 
1.7.0.4


^ permalink raw reply related

* Re: BUG in Mobile initiated pairing
From: Gustavo F. Padovan @ 2011-02-17 16:27 UTC (permalink / raw)
  To: sachin.athanikar; +Cc: linux-bluetooth
In-Reply-To: <23B1B83C3513ED4B8E8B2B9029CDE8EFC938867886@INDXM3113.dir.svc.accenture.com>

Hi Sachin,

* sachin.athanikar@accenture.com <sachin.athanikar@accenture.com> [2011-02-17 20:10:38 +0530]:

> Hi Gustavo,
> Many thanks for the response.
> 
> The property changed event "Paired" is not generated when the mobile initiated pairing is successful. So I am not able get an acknowledgement for successful completion of pairing process.

Yes, it is. I just tested it before reply to you.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [PATCH v2] Bluetooth: Fix some code style issues in hci_core.h
From: Gustavo F. Padovan @ 2011-02-17 16:30 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
In-Reply-To: <1297957320-14790-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

* Szymon Janc <szymon.janc@tieto.com> [2011-02-17 16:42:00 +0100]:

> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
>  include/net/bluetooth/hci_core.h |   58 +++++++++++++++++++-------------------
>  1 files changed, 29 insertions(+), 29 deletions(-)

It is now applied. Thanks.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [PATCH v2] Bluetooth: Fix some code style issues in hci_core.c
From: Gustavo F. Padovan @ 2011-02-17 16:32 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
In-Reply-To: <1297957607-15320-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

* Szymon Janc <szymon.janc@tieto.com> [2011-02-17 16:46:47 +0100]:

> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
>  net/bluetooth/hci_core.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)

Applied also. Thanks.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [PATCH v2] Bluetooth: Fix some code style issues in hci_event.c
From: Gustavo F. Padovan @ 2011-02-17 16:35 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
In-Reply-To: <1297957463-15223-1-git-send-email-szymon.janc@tieto.com>

Hi Szymon,

* Szymon Janc <szymon.janc@tieto.com> [2011-02-17 16:44:23 +0100]:

> Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> ---
>  net/bluetooth/hci_event.c |   18 ++++++++++--------
>  1 files changed, 10 insertions(+), 8 deletions(-)

Applied, thanks.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [RFCv2 3/4] Bluetooth: Use ERR_PTR to return error from hci_connect
From: Gustavo F. Padovan @ 2011-02-17 17:25 UTC (permalink / raw)
  To: anderson.briglia; +Cc: linux-bluetooth, Ville Tervo
In-Reply-To: <4d5d2589.8f7edc0a.5af6.27dd@mx.google.com>

Hi Ville,

* anderson.briglia@openbossa.org <anderson.briglia@openbossa.org> [2011-02-17 10:39:55 -0300]:

> From: Ville Tervo <ville.tervo@nokia.com>
> 
> Use ERR_PRT mechanism to return error from hci_connect. This patch also

Typo here, ERR_PTR.

> includes a change to return error if LE link exists already to remote host.
> 
> Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
> ---
>  net/bluetooth/hci_conn.c   |   12 +++++++-----
>  net/bluetooth/l2cap_core.c |   10 ++++------
>  net/bluetooth/sco.c        |    6 +++---
>  3 files changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index ee7dcdd..e06b856 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -305,7 +305,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
>  
>  	conn = kzalloc(sizeof(struct hci_conn), GFP_ATOMIC);
>  	if (!conn)
> -		return NULL;
> +		return ERR_PTR(-ENOMEM);

That's not really need. Seems that return NULL here means ENOMEM.

>  
>  	bacpy(&conn->dst, dst);
>  	conn->hdev  = hdev;
> @@ -459,8 +459,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
>  		le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
>  		if (!le)
>  			le = hci_conn_add(hdev, LE_LINK, dst);
> -		if (!le)
> -			return NULL;
> +		else
> +			return ERR_PTR(-EBUSY);
> +		if (IS_ERR(le))
> +			return le;

I prefer this instead:

                le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
                if (le)
                        return ERR_PTR(-EBUSY);

                le = hci_conn_add(hdev, LE_LINK, dst);
                if (!le)
                        return ERR_PTR(-ENOMEM);

Regards,

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* [PATCH] Use memcpy for network to host order function on BE hosts
From: Claudio Takahasi @ 2011-02-17 17:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Harmless change replacing "for" by "memcpy". Note that this change
is inside the block reserved to big endian functions.
---
 lib/sdp.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/lib/sdp.c b/lib/sdp.c
index 3e3a8f8..e782aec 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -62,13 +62,11 @@
 
 #if __BYTE_ORDER == __BIG_ENDIAN
 #define ntoh64(x) (x)
 static inline void ntoh128(const uint128_t *src, uint128_t *dst)
 {
-	int i;
-	for (i = 0; i < 16; i++)
-		dst->data[i] = src->data[i];
+	memcpy(dst, src, sizeof(uint128_t));
 }
 
 static inline void btoh128(const uint128_t *src, uint128_t *dst)
 {
 	int i;
-- 
1.7.4.1


^ permalink raw reply related

* Re: [RFCv2 1/4] Bluetooth: Implement advertising report meta event
From: Gustavo F. Padovan @ 2011-02-17 17:48 UTC (permalink / raw)
  To: anderson.briglia; +Cc: linux-bluetooth
In-Reply-To: <4d5d2585.8f7edc0a.5af6.27d8@mx.google.com>

Hi Briglia,

* anderson.briglia@openbossa.org <anderson.briglia@openbossa.org> [2011-02-17 10:39:53 -0300]:

> From: Anderson Briglia <anderson.briglia@openbossa.org>
> 
> This patch implements new LE meta event in order to handle advertising
> reports.
> 
> Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
> ---
>  include/net/bluetooth/hci.h |   18 ++++++++++++++++++
>  net/bluetooth/hci_event.c   |   22 ++++++++++++++++++++++
>  2 files changed, 40 insertions(+), 0 deletions(-)
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 46438f4..5180555 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -980,6 +980,24 @@ struct hci_ev_le_conn_complete {
>  	__u8     clk_accurancy;
>  } __packed;
>  
> +#define ADV_IND		0x00
> +#define ADV_DIRECT_IND	0x01
> +#define ADV_SCAN_IND	0x02
> +#define ADV_NONCONN_IND	0x03
> +#define SCAN_RSP	0x04

ADV_SCAN_RSP, maybe?

> +
> +#define ADDR_DEV_PUBLIC	0x00
> +#define ADDR_DEV_RANDOM	0x01

ADDR_LE_ here.

> +
> +#define HCI_EV_LE_ADVERTISING_REPORT	0x02
> +struct hci_ev_le_advertising_info {
> +	__u8	 evt_type;
> +	__u8	 bdaddr_type;
> +	bdaddr_t bdaddr;
> +	__u8	 length;
> +	__u8	 data[0];
> +} __packed;
> 
>  #define HCI_EV_LE_LTK_REQ		0x05
>  struct hci_ev_le_ltk_req {
>  	__le16	handle;
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 99c75f4..1c8d888 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -2498,6 +2498,24 @@ static inline void hci_le_ltk_request_evt(struct hci_dev *hdev,
>  	hci_dev_unlock(hdev);
>  }
>  
> +static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
> +						struct sk_buff *skb)
> +{
> +	struct hci_ev_le_advertising_info *ev;
> +	u8 num_reports, i;
> +
> +	num_reports = skb->data[0];
> +
> +	ev = (void *) &skb->data[1];
> +
> +	BT_DBG("adv from: %s", batostr(&ev->bdaddr));
> +
> +	for (i = 1; i < num_reports; i++) {
> +		ev = (void *) (ev->data + ev->length + 1);

You are not using i anywhere here.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply

* Re: [RFCv2 3/4] Bluetooth: Use ERR_PTR to return error from hci_connect
From: Anderson Lizardo @ 2011-02-17 17:59 UTC (permalink / raw)
  To: anderson.briglia; +Cc: linux-bluetooth, Ville Tervo
In-Reply-To: <4d5d2589.8f7edc0a.5af6.27dd@mx.google.com>

Hi Briglia,

On Thu, Feb 17, 2011 at 10:39 AM,  <anderson.briglia@openbossa.org> wrote:
> @@ -472,8 +474,8 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
>        acl = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
>        if (!acl) {
>                acl = hci_conn_add(hdev, ACL_LINK, dst);
> -               if (!acl)
> -                       return NULL;
> +               if (IS_ERR(acl))
> +                       return acl;
>        }

Note that if you follow Gustavo's suggestion to keep hci_conn_add()
returning NULL on ENOMEM, you should change this as well:

if (!acl)
    return ERR_PTR(-ENOMEM);

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: [RFCv2 3/4] Bluetooth: Use ERR_PTR to return error from hci_connect
From: Anderson Lizardo @ 2011-02-17 18:04 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: anderson.briglia, linux-bluetooth, Ville Tervo
In-Reply-To: <20110217172531.GJ10543@joana>

Hi Gustavo,

On Thu, Feb 17, 2011 at 2:25 PM, Gustavo F. Padovan
<padovan@profusion.mobi> wrote:
>> @@ -459,8 +459,10 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
>>               le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
>>               if (!le)
>>                       le = hci_conn_add(hdev, LE_LINK, dst);
>> -             if (!le)
>> -                     return NULL;
>> +             else
>> +                     return ERR_PTR(-EBUSY);
>> +             if (IS_ERR(le))
>> +                     return le;
>
> I prefer this instead:
>
>                le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
>                if (le)
>                        return ERR_PTR(-EBUSY);
>
>                le = hci_conn_add(hdev, LE_LINK, dst);
>                if (!le)
>                        return ERR_PTR(-ENOMEM);

I think the code above (besides the "if (le)" typo) is not equivalent
to the original one. See:

>>               le = hci_conn_hash_lookup_ba(hdev, LE_LINK, dst);
>>               if (!le)
>>                       le = hci_conn_add(hdev, LE_LINK, dst);
>> -             if (!le)
>> -                     return NULL;

if hci_conn_hash_lookup_ba() returns NULL, it should call
hci_conn_add(), and if that fails, then return NULL (or some
ERR_PTR()).

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: [RFCv2 1/4] Bluetooth: Implement advertising report meta event
From: Anderson Lizardo @ 2011-02-17 18:09 UTC (permalink / raw)
  To: Gustavo F. Padovan; +Cc: anderson.briglia, linux-bluetooth
In-Reply-To: <20110217174806.GK10543@joana>

Hi Gustavo,

On Thu, Feb 17, 2011 at 2:48 PM, Gustavo F. Padovan
<padovan@profusion.mobi> wrote:
>> +     for (i = 1; i < num_reports; i++) {
>> +             ev = (void *) (ev->data + ev->length + 1);
>
> You are not using i anywhere here.

It's used to iterate the for() itself, but it could be changed to e.g.:

while (--num_reports) {
...
}

It is pre-incremented to skip the first report as it was already
processed outside the loop.

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

^ permalink raw reply

* Re: [PATCH v2] Fix no SEP if corresponding interface is disabled
From: Johan Hedberg @ 2011-02-17 18:35 UTC (permalink / raw)
  To: Dmitriy Paliy; +Cc: linux-bluetooth, luiz.dentz
In-Reply-To: <1297935077-25540-2-git-send-email-dmitriy.paliy@nokia.com>

Hi Dmitriy,

On Thu, Feb 17, 2011, Dmitriy Paliy wrote:
> A2DP sink endpoint shall not be created if A2DP sink interface is disabled.
> Same holds for A2DP source endpoint and A2DP source interface.
> 
> Such fixes bluetoothd crash when SDP record is registered and remote
> device tries to connect and stream to A2DP sink which is not initialized.
> Dereferencing of NULL happens in source_new_stream since device->source
> was not created.
> ---
>  audio/a2dp.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)

Pushed upstream. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 1/4] Add static Device Appearance Characteristic
From: Johan Hedberg @ 2011-02-17 18:36 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1297897651-27731-1-git-send-email-claudio.takahasi@openbossa.org>

Hi Claudio,

On Wed, Feb 16, 2011, Claudio Takahasi wrote:
> Declaration and definition of the Device Appearance Characteristic
> defined in the GAP Characteristics for Low Energy section: Bluetooth
> Core Specification, Volume 3, Part C, section 12.2.
> ---
>  src/attrib-server.c |   14 ++++++++++++--
>  1 files changed, 12 insertions(+), 2 deletions(-)

All four patches have been pushed upstream. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 1/2] Fix not responding to pbap GET when data is already cached
From: Johan Hedberg @ 2011-02-17 18:45 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1297932809-3460-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Thu, Feb 17, 2011, Luiz Augusto von Dentz wrote:
> When data is cached but no stream/body is set the driver .write is never
> called so no response is generated.
> ---
>  src/obex.c |   35 +++++++++++++++--------------------
>  1 files changed, 15 insertions(+), 20 deletions(-)

Thanks. Both patches have been pushed upstream.

Johan

^ permalink raw reply

* Re: [PATCH v2 0/2] Clean up in the minimum mtu check
From: Johan Hedberg @ 2011-02-17 18:50 UTC (permalink / raw)
  To: Sheldon Demario; +Cc: linux-bluetooth
In-Reply-To: <1297952321-12523-1-git-send-email-sheldon.demario@openbossa.org>

Hi Sheldon,

On Thu, Feb 17, 2011, Sheldon Demario wrote:
> Just a little clean up in the minimum mtu check
> 
> Sheldon Demario (2):
>   Move do_connect() to a common file between interactive.c and
>     gatttool.c
>   Use PSM value to select LE or BR/EDR transport on gatttool
> 
>  Makefile.am          |    3 +-
>  attrib/gatttool.c    |   83 ++++-----------------------------------
>  attrib/gatttool.h    |    4 +-
>  attrib/interactive.c |   25 ++++++++----
>  attrib/utils.c       |  107 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 137 insertions(+), 85 deletions(-)
>  create mode 100644 attrib/utils.c

Both patches have been pushed upstream. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] Use memcpy for network to host order function on BE hosts
From: Johan Hedberg @ 2011-02-17 18:53 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth
In-Reply-To: <1297964368-23733-1-git-send-email-claudio.takahasi@openbossa.org>

Hi Claudio,

On Thu, Feb 17, 2011, Claudio Takahasi wrote:
> Harmless change replacing "for" by "memcpy". Note that this change
> is inside the block reserved to big endian functions.
> ---
>  lib/sdp.c |    4 +---
>  1 files changed, 1 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: PATCH [1/2] batostr(): Switch byte order before converting
From: Johan Hedberg @ 2011-02-17 19:04 UTC (permalink / raw)
  To: David Herrmann; +Cc: linux-bluetooth
In-Reply-To: <AANLkTinBBdyyUR5-f=HMBNZ-38KnGdnU_M38kzcLuoBg@mail.gmail.com>

Hi David,

On Wed, Feb 16, 2011, David Herrmann wrote:
> The library function batostr() computes incorrect results because it
> does not swap byte-ordering before converting the address. This patch
> fixes this behaviour. It tries to make batostr() look like ba2str() to
> be consistent.

We can't go ahead and change the behavior of existing libbluetooth
functions like that since it would break any applications relying on the
old behavior (without baswap). So this patch isn't acceptable upstream.

Johan

^ permalink raw reply

* Re: PATCH [2/2] batostr(): Replace batostr() where possible with ba2str to avoid memleaks
From: Johan Hedberg @ 2011-02-17 19:05 UTC (permalink / raw)
  To: David Herrmann; +Cc: linux-bluetooth
In-Reply-To: <AANLkTimfR_dhOE-k5c3zJ1+dwMwOCBqq-Y6Df-=rp8FP@mail.gmail.com>

Hi David,

On Wed, Feb 16, 2011, David Herrmann wrote:
> batostr() returns a dynamically allocated string which must be freed
> later, although, the function looks like the standard berkeley socket
> functions that work on static buffers. Two functions inside bluez
> incorrectly use batostr() and do not free the returned pointer. I
> replaced the occurrence of batostr() with a ba2str().

This patch looks good, but you've managed to format it in such away that
I can't feed it directly to git am. Could you try resending with git
send-email?

Johan

^ permalink raw reply

* [PATCH] Add Primary Discovery Services option to interactive gatttool
From: Sheldon Demario @ 2011-02-17 20:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

---
 attrib/interactive.c |   70 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/attrib/interactive.c b/attrib/interactive.c
index 1df2b69..edc465a 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -25,11 +25,17 @@
 #include <stdio.h>
 #include <glib.h>
 
+#include <bluetooth/sdp.h>
+#include <bluetooth/sdp_lib.h>
+
 #include <readline/readline.h>
 #include <readline/history.h>
 
+#include "att.h"
 #include "btio.h"
 #include "gattrib.h"
+#include "glib-helper.h"
+#include "gatt.h"
 #include "gatttool.h"
 
 static GIOChannel *iochannel = NULL;
@@ -98,6 +104,47 @@ static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
 	set_state(STATE_CONNECTED);
 }
 
+static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
+{
+	GSList *l;
+
+	if (status) {
+		printf("Discover all primary services failed: %s\n",
+							att_ecode2str(status));
+		return;
+	}
+
+	printf("\n");
+	for (l = services; l; l = l->next) {
+		struct att_primary *prim = l->data;
+		printf("attr handle: 0x%04x, end grp handle: 0x%04x "
+			"uuid: %s\n", prim->start, prim->end, prim->uuid);
+	}
+
+	rl_forced_update_display();
+}
+
+static void primary_by_uuid_cb(GSList *ranges, guint8 status,
+							gpointer user_data)
+{
+	GSList *l;
+
+	if (status) {
+		printf("Discover primary services by UUID failed: %s\n",
+							att_ecode2str(status));
+		return;
+	}
+
+	printf("\n");
+	for (l = ranges; l; l = l->next) {
+		struct att_range *range = l->data;
+		g_print("Starting handle: 0x%04x Ending handle: 0x%04x\n",
+						range->start, range->end);
+	}
+
+	rl_forced_update_display();
+}
+
 static void cmd_exit(int argcp, char **argvp)
 {
 	rl_callback_handler_remove();
@@ -145,6 +192,28 @@ static void cmd_disconnect(int argcp, char **argvp)
 	return;
 }
 
+static void cmd_primary(int argcp, char **argvp)
+{
+	uuid_t uuid;
+
+	if (conn_state != STATE_CONNECTED) {
+		printf("Command failed: disconnected\n");
+		return;
+	}
+
+	if (argcp == 1) {
+		gatt_discover_primary(attrib, NULL, primary_all_cb, NULL);
+		return;
+	}
+
+	if (bt_string2uuid(&uuid, argvp[1]) < 0) {
+		printf("Invalid UUID\n");
+		return;
+	}
+
+	gatt_discover_primary(attrib, &uuid, primary_by_uuid_cb, NULL);
+}
+
 static struct {
 	const char *cmd;
 	void (*func)(int argcp, char **argvp);
@@ -154,6 +223,7 @@ static struct {
 	{ "exit",	cmd_exit,	"Exit interactive mode"},
 	{ "connect",	cmd_connect,	"Connect to a remote device"},
 	{ "disconnect",	cmd_disconnect,	"Disconnect from a remote device"},
+	{ "primary",	cmd_primary,	"Primary Service Discovery"},
 	{ NULL, NULL, NULL}
 };
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH] Replace batostr() with ba2str() to avoid memleaks
From: David Herrmann @ 2011-02-17 23:06 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, David Herrmann

batostr() returns dynamically allocated strings. Replace it with
ba2str() wherever possible to avoid heap allocations and fix
memleaks.
---
 compat/bnep.c |    5 +++--
 test/hciemu.c |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/compat/bnep.c b/compat/bnep.c
index 9b0d8b8..3617e0e 100644
--- a/compat/bnep.c
+++ b/compat/bnep.c
@@ -128,6 +128,7 @@ int bnep_show_connections(void)
 	struct bnep_connlist_req req;
 	struct bnep_conninfo ci[48];
 	unsigned int i;
+	char buf[18];
 
 	req.cnum = 48;
 	req.ci   = ci;
@@ -137,9 +138,9 @@ int bnep_show_connections(void)
 	}
 
 	for (i = 0; i < req.cnum; i++) {
+		ba2str((bdaddr_t*)ci[i].dst, buf);
 		printf("%s %s %s\n", ci[i].device,
-			batostr((bdaddr_t *) ci[i].dst),
-			bnep_svc2str(ci[i].role));
+			buf, bnep_svc2str(ci[i].role));
 	}
 	return 0;
 }
diff --git a/test/hciemu.c b/test/hciemu.c
index ba9b89d..db7c613 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -499,8 +499,10 @@ static void accept_connection(uint8_t *data)
 
 static void close_connection(struct vhci_conn *conn)
 {
+	char buf[18];
+	ba2str(&conn->dest, buf);
 	syslog(LOG_INFO, "Closing connection %s handle %d",
-					batostr(&conn->dest), conn->handle);
+					buf, conn->handle);
 
 	g_io_channel_shutdown(conn->chan, TRUE, NULL);
 	g_io_channel_unref(conn->chan);
-- 
1.7.4.1


^ permalink raw reply related

* Re: PATCH [1/2] batostr(): Switch byte order before converting
From: David Herrmann @ 2011-02-17 23:10 UTC (permalink / raw)
  To: David Herrmann, linux-bluetooth
In-Reply-To: <20110217190401.GA22042@jh-x301>

Hi Johan,

On Thu, Feb 17, 2011 at 8:04 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> We can't go ahead and change the behavior of existing libbluetooth
> functions like that since it would break any applications relying on the
> old behavior (without baswap). So this patch isn't acceptable upstream.

I thought of this more like a bug because it doesn't make sense to me
why there should be a function returning the string without swapping
the bytes first. So I didn't think of this as breaking the API, but
more like fixing a function that is not used because it produces
incorrect results.
Anyway, your explanation makes sense and I don't use this function so
I am totally ok with that.

David

^ permalink raw reply


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