Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 04/10 v2] Bluetooth: Refactor valid LTK data testing into its own function
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

This patch refactors valid LTK data testing into its own function. This
will help keep the code readable since there are several tests still
missing that need to be done on the LTK data.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index c7ec47c..cd75899 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2701,6 +2701,13 @@ done:
 	return err;
 }
 
+static bool ltk_is_valid(struct mgmt_ltk_info *key)
+{
+	if (key->master != 0x00 && key->master != 0x01)
+		return false;
+	return true;
+}
+
 static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
 			       void *cp_data, u16 len)
 {
@@ -2724,7 +2731,7 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
 	for (i = 0; i < key_count; i++) {
 		struct mgmt_ltk_info *key = &cp->keys[i];
 
-		if (key->master != 0x00 && key->master != 0x01)
+		if (!ltk_is_valid(key))
 			return cmd_status(sk, hdev->id,
 					  MGMT_OP_LOAD_LONG_TERM_KEYS,
 					  MGMT_STATUS_INVALID_PARAMS);
-- 
1.7.10.4


^ permalink raw reply related

* [PATCH 05/10 v2] Bluetooth: Check for valid key->authenticated value for LTKs
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

This patch adds necessary checks for the two allowed values of the
authenticated parameter of each Long Term Key, i.e. 0x00 and 0x01. If
any other value is encountered the valid response is to return invalid
params to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index cd75899..bc04c44 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2703,6 +2703,8 @@ done:
 
 static bool ltk_is_valid(struct mgmt_ltk_info *key)
 {
+	if (key->authenticated != 0x00 && key->authenticated != 0x01)
+		return false;
 	if (key->master != 0x00 && key->master != 0x01)
 		return false;
 	return true;
-- 
1.7.10.4


^ permalink raw reply related

* [PATCH 06/10 v2] Bluetooth: Add helper functions for testing bdaddr types
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

This patch adds two helper functions to test for valid bdaddr type
values. These will be particularely useful in the mgmt code to check
that user space has passed valid values to the kernel.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 include/net/bluetooth/bluetooth.h |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 2554b3f..9531bee 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -166,6 +166,29 @@ typedef struct {
 #define BDADDR_LE_PUBLIC	0x01
 #define BDADDR_LE_RANDOM	0x02
 
+static inline bool bdaddr_type_is_valid(__u8 type)
+{
+	switch (type) {
+	case BDADDR_BREDR:
+	case BDADDR_LE_PUBLIC:
+	case BDADDR_LE_RANDOM:
+		return true;
+	}
+
+	return false;
+}
+
+static inline bool bdaddr_type_is_le(__u8 type)
+{
+	switch (type) {
+	case BDADDR_LE_PUBLIC:
+	case BDADDR_LE_RANDOM:
+		return true;
+	}
+
+	return false;
+}
+
 #define BDADDR_ANY   (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} })
 #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCH 07/10 v2] Bluetooth: Fix checking for valid address type values in mgmt commands
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

This patch adds checks for valid address type values passed to mgmt
commands. If an invalid address type is encountered the code will return
a proper invalid params response.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c |   36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index bc04c44..7dd2de1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1526,6 +1526,14 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
 	BT_DBG("%s debug_keys %u key_count %u", hdev->name, cp->debug_keys,
 	       key_count);
 
+	for (i = 0; i < key_count; i++) {
+		struct mgmt_link_key_info *key = &cp->keys[i];
+
+		if (key->addr.type != BDADDR_BREDR)
+			return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
+					  MGMT_STATUS_INVALID_PARAMS);
+	}
+
 	hci_dev_lock(hdev);
 
 	hci_link_keys_clear(hdev);
@@ -1573,12 +1581,17 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 	struct hci_conn *conn;
 	int err;
 
-	hci_dev_lock(hdev);
-
 	memset(&rp, 0, sizeof(rp));
 	bacpy(&rp.addr.bdaddr, &cp->addr.bdaddr);
 	rp.addr.type = cp->addr.type;
 
+	if (!bdaddr_type_is_valid(cp->addr.type))
+		return cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &rp, sizeof(rp));
+
+	hci_dev_lock(hdev);
+
 	if (!hdev_is_powered(hdev)) {
 		err = cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
 				   MGMT_STATUS_NOT_POWERED, &rp, sizeof(rp));
@@ -1643,6 +1656,10 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
 
 	BT_DBG("");
 
+	if (!bdaddr_type_is_valid(cp->addr.type))
+		return cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
+				  MGMT_STATUS_INVALID_PARAMS);
+
 	hci_dev_lock(hdev);
 
 	if (!test_bit(HCI_UP, &hdev->flags)) {
@@ -1947,6 +1964,11 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 	bacpy(&rp.addr.bdaddr, &cp->addr.bdaddr);
 	rp.addr.type = cp->addr.type;
 
+	if (!bdaddr_type_is_valid(cp->addr.type))
+		return cmd_complete(sk, hdev->id, MGMT_OP_PAIR_DEVICE,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &rp, sizeof(rp));
+
 	hci_dev_lock(hdev);
 
 	if (!hdev_is_powered(hdev)) {
@@ -2564,6 +2586,10 @@ static int block_device(struct sock *sk, struct hci_dev *hdev, void *data,
 
 	BT_DBG("%s", hdev->name);
 
+	if (!bdaddr_type_is_valid(cp->addr.type))
+		return cmd_status(sk, hdev->id, MGMT_OP_BLOCK_DEVICE,
+				  MGMT_STATUS_INVALID_PARAMS);
+
 	hci_dev_lock(hdev);
 
 	err = hci_blacklist_add(hdev, &cp->addr.bdaddr, cp->addr.type);
@@ -2589,6 +2615,10 @@ static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data,
 
 	BT_DBG("%s", hdev->name);
 
+	if (!bdaddr_type_is_valid(cp->addr.type))
+		return cmd_status(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE,
+				  MGMT_STATUS_INVALID_PARAMS);
+
 	hci_dev_lock(hdev);
 
 	err = hci_blacklist_del(hdev, &cp->addr.bdaddr, cp->addr.type);
@@ -2707,6 +2737,8 @@ static bool ltk_is_valid(struct mgmt_ltk_info *key)
 		return false;
 	if (key->master != 0x00 && key->master != 0x01)
 		return false;
+	if (!bdaddr_type_is_le(key->addr.type))
+		return false;
 	return true;
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCH 08/10 v2] Bluetooth: Fix checking for valid disconnect parameters in unpair_device
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

The valid values for the Disconnect parameter in the Unpair Device
command are 0x00 and 0x01. If any other value is encountered the command
should fail with the appropriate invalid params response.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/mgmt.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7dd2de1..e5e865d 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1590,6 +1590,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 				    MGMT_STATUS_INVALID_PARAMS,
 				    &rp, sizeof(rp));
 
+	if (cp->disconnect != 0x00 && cp->disconnect != 0x01)
+		return cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &rp, sizeof(rp));
+
 	hci_dev_lock(hdev);
 
 	if (!hdev_is_powered(hdev)) {
-- 
1.7.10.4


^ permalink raw reply related

* [PATCH 09/10 v2] Bluetooth: Fix returning proper cmd_complete for mgmt_disconnect
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

The Disconnect Management command should return Command Complete instead
of Command Status whenever possible so that user space can distinguish
exactly which command failed in the case of multiple commands. This
patch does the necessary changes in the disconnect command handler to
return the right event to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index e5e865d..7b8bc7c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1654,6 +1654,7 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
 		      u16 len)
 {
 	struct mgmt_cp_disconnect *cp = data;
+	struct mgmt_rp_disconnect rp;
 	struct hci_cp_disconnect dc;
 	struct pending_cmd *cmd;
 	struct hci_conn *conn;
@@ -1661,21 +1662,26 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
 
 	BT_DBG("");
 
+	memset(&rp, 0, sizeof(rp));
+	bacpy(&rp.addr.bdaddr, &cp->addr.bdaddr);
+	rp.addr.type = cp->addr.type;
+
 	if (!bdaddr_type_is_valid(cp->addr.type))
-		return cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
-				  MGMT_STATUS_INVALID_PARAMS);
+		return cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &rp, sizeof(rp));
 
 	hci_dev_lock(hdev);
 
 	if (!test_bit(HCI_UP, &hdev->flags)) {
-		err = cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
-				 MGMT_STATUS_NOT_POWERED);
+		err = cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT,
+				   MGMT_STATUS_NOT_POWERED, &rp, sizeof(rp));
 		goto failed;
 	}
 
 	if (mgmt_pending_find(MGMT_OP_DISCONNECT, hdev)) {
-		err = cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
-				 MGMT_STATUS_BUSY);
+		err = cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT,
+				   MGMT_STATUS_BUSY, &rp, sizeof(rp));
 		goto failed;
 	}
 
@@ -1686,8 +1692,8 @@ static int disconnect(struct sock *sk, struct hci_dev *hdev, void *data,
 		conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &cp->addr.bdaddr);
 
 	if (!conn || conn->state == BT_OPEN || conn->state == BT_CLOSED) {
-		err = cmd_status(sk, hdev->id, MGMT_OP_DISCONNECT,
-				 MGMT_STATUS_NOT_CONNECTED);
+		err = cmd_complete(sk, hdev->id, MGMT_OP_DISCONNECT,
+				   MGMT_STATUS_NOT_CONNECTED, &rp, sizeof(rp));
 		goto failed;
 	}
 
-- 
1.7.10.4


^ permalink raw reply related

* [PATCH 10/10 v2] Bluetooth: Fix returning proper cmd_complete for mgmt_block/unblock
From: Johan Hedberg @ 2013-01-20 12:27 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358684842-4441-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

The Block/Unblock Device Management commands should return Command
Complete instead of Command Status whenever possible so that user space
can distinguish exactly which command failed in the case of multiple
commands. This patch does the necessary changes in the command handler
to return the right event to user space.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7b8bc7c..e7f944f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2598,8 +2598,9 @@ static int block_device(struct sock *sk, struct hci_dev *hdev, void *data,
 	BT_DBG("%s", hdev->name);
 
 	if (!bdaddr_type_is_valid(cp->addr.type))
-		return cmd_status(sk, hdev->id, MGMT_OP_BLOCK_DEVICE,
-				  MGMT_STATUS_INVALID_PARAMS);
+		return cmd_complete(sk, hdev->id, MGMT_OP_BLOCK_DEVICE,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &cp->addr, sizeof(cp->addr));
 
 	hci_dev_lock(hdev);
 
@@ -2627,8 +2628,9 @@ static int unblock_device(struct sock *sk, struct hci_dev *hdev, void *data,
 	BT_DBG("%s", hdev->name);
 
 	if (!bdaddr_type_is_valid(cp->addr.type))
-		return cmd_status(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE,
-				  MGMT_STATUS_INVALID_PARAMS);
+		return cmd_complete(sk, hdev->id, MGMT_OP_UNBLOCK_DEVICE,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &cp->addr, sizeof(cp->addr));
 
 	hci_dev_lock(hdev);
 
-- 
1.7.10.4


^ permalink raw reply related

* RE: [PATCH] hcidump: Add TI Logger dump support
From: Ganir, Chen @ 2013-01-20 18:58 UTC (permalink / raw)
  To: Ganir, Chen, marcel@holtmann.org, linux-bluetooth@vger.kernel.org
In-Reply-To: <1356354253-26134-1-git-send-email-chen.ganir@ti.com>


> -----Original Message-----
> From: Ganir, Chen
> Sent: Monday, December 24, 2012 3:04 PM
> To: marcel@holtmann.org; linux-bluetooth@vger.kernel.org
> Cc: Ganir, Chen
> Subject: [PATCH] hcidump: Add TI Logger dump support
>=20
> From: Chen Ganir <chen.ganir@ti.com>
>=20
> Texas Instruments controllers can be configured to send the
> internal firmware log through a vendor specific HCI event on
> the hci transport.
> This patch allows capturing those log events, and writing them
> to a file, which can then be used with the latest TI Logger
> application to read and show the logs.
>=20
> This is usefull in case there is no other way to get the TI log
> (for example, the lack of a connection to the controller Log TX
> hardware line).


Holtmann, Did you forget this one ? This is the fixed version, after your c=
omments.

Thanks,
Chen Ganir.

^ permalink raw reply

* Re: [PATCH] Bluetooth: btmrvl_sdio: look for sd8688 firmware in alternate place
From: Ben Hutchings @ 2013-01-21  1:12 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Marcel Holtmann, David Woodhouse, Bing Zhao,
	libertas-dev@lists.infradead.org, linux-bluetooth@vger.kernel.org,
	Gustavo Padovan, Johan Hedberg, linux-kernel@vger.kernel.org
In-Reply-To: <1358494422.28503.4.camel@unicorn>

[-- Attachment #1: Type: text/plain, Size: 1759 bytes --]

On Fri, 2013-01-18 at 08:33 +0100, Lubomir Rintel wrote:
> On Tue, 2013-01-08 at 22:35 -0800, Marcel Holtmann wrote:
> > Hi Lubomir,
> > 
> > > > > > linux-firmware ships the sd8688* firmware images that are shared with
> > > > > > libertas_sdio WiFi driver under libertas/. libertas_sdio looks in both places
> > > > > > and so should we.
> > > > > >
> > > > > > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> > > > > > ---
> > > > > >  drivers/bluetooth/btmrvl_sdio.c |   24 ++++++++++++++++++++++--
> > > > > >  drivers/bluetooth/btmrvl_sdio.h |    6 ++++--
> > > > > >  2 files changed, 26 insertions(+), 4 deletions(-)
> > > > > 
> > > > > NAK from me on this one. I do not want the driver to check two
> > > > > locations. That is what userspace can work around.
> > > > > 
> > > > > If we want to unify the location between the WiFi driver and the
> > > > > Bluetooth driver, I am fine with that, but seriously, just pick one over
> > > > > the other. I do not care which one.
> > > > 
> > > > The unified location is mrvl/ directory.
> > > > 
> > > > We can probably move SD8688 firmware & helper binaries to mrvl/ and have both drivers grab the images there?
> > > 
> > > That would break existing setups, wouldn't it?
> > > 
> > > I was under impression (commit 3d32a58b) that we care about
> > > compatibility here. Do we?
> > 
> > that is what symlinks are for.
> 
> David, Ben: please pull the following branch then:
> git pull git://github.com/lkundrak/linux-firmware.git sd8688-move
> 
> Thank you!

The symlinks are broken, and you didn't update WHENCE.

Ben.

-- 
Ben Hutchings
Q.  Which is the greater problem in the world today, ignorance or apathy?
A.  I don't know and I couldn't care less.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply

* Re: sd8688 firmware location
From: Ben Hutchings @ 2013-01-21  1:13 UTC (permalink / raw)
  To: Dan Williams
  Cc: Lubomir Rintel, David Woodhouse, libertas-dev, linux-bluetooth,
	Gustavo Padovan, Marcel Holtmann, Johan Hedberg, linux-kernel
In-Reply-To: <1357771504.12030.59.camel@dcbw.foobar.com>

[-- Attachment #1: Type: text/plain, Size: 2093 bytes --]

On Wed, 2013-01-09 at 16:45 -0600, Dan Williams wrote:
> On Wed, 2013-01-09 at 00:56 +0100, Lubomir Rintel wrote:
> > Hi!
> > 
> > btmrvl_sdio and libertas_sdio both use firmware files sd8688.bin and
> > sd8688_helper.bin. In linux-firmware, they're present in libertas/ tree and
> > (since 3d32a58b) libertas_sdio perfers loading it from there, while it is able
> > to fallback to load it from linux-firmware root. btmrvl_sdio, on the other hand
> > only looks in the root and ends up not being successful.
> > 
> > Obviously, there are two solutions to the problem -- either teach btmrvl_sdio
> > to look into libertas/, or move the files in linux-firmware tree. I don't
> > really have a strong preference, though it probably makes less sense to keep in
> > in libertas/, since the bluetooth hardware is not really marketed as "Libertas."
> > 
> > I'm following up with patches to linux and linux-firmware and I'd be very
> > thankful if you could pick one (not both of them).
> 
> So the BT part and the wifi part have different SDIO IDs; are they
> actually connected separately to the SDIO bus?  Or is the chip only in
> one mode at one time or something like that?  Is there a problem with
> having both libertas and btmrvl loaded at the same time since they're
> essentially the same chip?
> 
> I don't really mind moving stuff to mrvl/ out of libertas/ for these
> devices, but I do want some backwards compat code in libertas for that.
> Unless, of course, Marcel was talking about symlinks in the
> linux-firmware git tree, which would be fine with me.  The important
> point is that simply updating your linux-firmware package or install or
> whatever *should not* result in a failed firmware load.

The general policy for linux-firmware.git has been that all filenames
required by all mainline kernel releases will be supported indefinitely.
There is already precedent for compatibility symlinks.

Ben.

-- 
Ben Hutchings
Q.  Which is the greater problem in the world today, ignorance or apathy?
A.  I don't know and I couldn't care less.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply

* Re: multiboot sync bluetooth pair key
From: Andrei Emeltchenko @ 2013-01-21  8:29 UTC (permalink / raw)
  To: Ilya Basin; +Cc: linux-bluetooth
In-Reply-To: <892087990.20130120132430@gmail.com>

Hi,

On Sun, Jan 20, 2013 at 01:24:30PM +0400, Ilya Basin wrote:
> Hi. Is there any software to sync the bluetooth pair key over Linux
> and Windows, so one won't need to pair the device again?

Why do you need to pair again? Do you mean your keys get lost?

> Where is the key stored on Linux?

/var/lib/bluetooth/...

Best regards 
Andrei Emeltchenko 

> Is it DE-specific?
> Where is it stored on Windows?
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Object manager properties on Network1 Connect method call reply
From: Patrik Flykt @ 2013-01-21  8:30 UTC (permalink / raw)
  To: linux-bluetooth


	Hi,

While implementing ConnMan Bluez 5 plugin using GDBusProxy from ./gdbus
I noticed the following things.

On org.bluez.Network1.Connect method call return the object properties
'Connected', 'Interface' and 'UUID' have not yet been updated. It is of
course obvious that if no error occurs, the network is connected. And
the interface is provided as an argument to the method call return
function so that's fine as well.

If the method call signals an error, then the network is of course not
connected. Except if the error is 'AlreadyConnected', which means it is.
Since it is not possible to send arguments in an error reply, the only
way to figure out the interface is via the 'Interface' GDBusProxy
property. 'Connected' and 'UUID' properties are also set properly in
this case.

>From the above it would be more consistent if the properties were
already set to their intended values when the Connect method call
returns independent of success or failure. Thus one set of logic would
suffice on ConnMan side to handle both cases.

Maybe the org.bluez.Network1 object properties could be updated only for
the Network1 object in question before sending the method call return?
Of course the devil may be in the details of the Bluez 5 API why the
object property update should not or can not be done this way.

Just my €0.02 on this.

Cheers,

	Patrik



^ permalink raw reply

* Re[2]: multiboot sync bluetooth pair key
From: Ilya Basin @ 2013-01-21  8:50 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <20130121082906.GC18141@aemeltch-MOBL1>

AE> Hi,

AE> On Sun, Jan 20, 2013 at 01:24:30PM +0400, Ilya Basin wrote:
>> Hi. Is there any software to sync the bluetooth pair key over Linux
>> and Windows, so one won't need to pair the device again?

AE> Why do you need to pair again? Do you mean your keys get lost?
For example, I boot Linux, pair the device and use it.
Then I boot Windows and I have to pair it too.
Then I boot Linux again: although I paired it already on this OS, the
phone doesn't think so. It refuses to work until I pair it again.

>> Where is the key stored on Linux?

AE> /var/lib/bluetooth/...

AE> Best regards 
AE> Andrei Emeltchenko 

>> Is it DE-specific?
>> Where is it stored on Windows?
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 


^ permalink raw reply

* Re: Object manager properties on Network1 Connect method call reply
From: Luiz Augusto von Dentz @ 2013-01-21  9:25 UTC (permalink / raw)
  To: Patrik Flykt; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1358757002.7854.27.camel@pflykt-mobl1>

Hi Patrick,

On Mon, Jan 21, 2013 at 10:30 AM, Patrik Flykt
<patrik.flykt@linux.intel.com> wrote:
>
>         Hi,
>
> While implementing ConnMan Bluez 5 plugin using GDBusProxy from ./gdbus
> I noticed the following things.
>
> On org.bluez.Network1.Connect method call return the object properties
> 'Connected', 'Interface' and 'UUID' have not yet been updated. It is of
> course obvious that if no error occurs, the network is connected. And
> the interface is provided as an argument to the method call return
> function so that's fine as well.
>
> If the method call signals an error, then the network is of course not
> connected. Except if the error is 'AlreadyConnected', which means it is.
> Since it is not possible to send arguments in an error reply, the only
> way to figure out the interface is via the 'Interface' GDBusProxy
> property. 'Connected' and 'UUID' properties are also set properly in
> this case.

I suppose you also have a callback to properties changed signal so in
case of AlreadyConnected error I guess you should not even call it if
you happen to detect it is already connected.

> From the above it would be more consistent if the properties were
> already set to their intended values when the Connect method call
> returns independent of success or failure. Thus one set of logic would
> suffice on ConnMan side to handle both cases.
>
> Maybe the org.bluez.Network1 object properties could be updated only for
> the Network1 object in question before sending the method call return?
> Of course the devil may be in the details of the Bluez 5 API why the
> object property update should not or can not be done this way.

Yep, we discussed this before an came to a conclusion that we probably
need a way to propagate changes immediately in certain situations to
avoid swallow changes, one idea was to modify
g_dbus_emit_property_changed to take a flag or create another property
flag e.g. G_DBUS_PROPERTY_FLAG_CHANGE_IMMEDIATELY or
G_DBUS_PROPERTY_FLAG_NO_WAIT.


--
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH 1/3] health: Fix possible use after free
From: Syam Sidhardhan @ 2013-01-21 13:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Syam Sidhardhan

A pointer to freed memory is dereferenced if we call function
hdp_get_dcpsm_cb() with out any earlier reference.
---
 profiles/health/hdp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index c15f06a..a42ca48 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -542,9 +542,9 @@ static void hdp_get_dcpsm_cb(uint16_t dcpsm, gpointer user_data, GError *err)
 					hdp_tmp_dc_data_destroy, &gerr))
 		return;
 
-	hdp_tmp_dc_data_unref(hdp_conn);
 	hdp_conn->cb(hdp_chann->mdl, err, hdp_conn);
 	g_error_free(gerr);
+	hdp_tmp_dc_data_unref(hdp_conn);
 }
 
 static void device_reconnect_mdl_cb(struct mcap_mdl *mdl, GError *err,
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/3] a2dp: Fix invalid memory access during suspend_ind()
From: Syam Sidhardhan @ 2013-01-21 13:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Syam Sidhardhan
In-Reply-To: <1358775211-31005-1-git-send-email-s.syam@samsung.com>

There is a possible invalid memory access during suspend_ind().
We should terminate the variable arguments with NULL.
---
 profiles/audio/a2dp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 46f41a6..3c546d9 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -801,7 +801,7 @@ static gboolean suspend_ind(struct avdtp *session, struct avdtp_local_sep *sep,
 	if (start_err < 0 && start_err != -EINPROGRESS) {
 		error("avdtp_start: %s (%d)", strerror(-start_err),
 								-start_err);
-		finalize_setup_errno(setup, start_err, finalize_resume);
+		finalize_setup_errno(setup, start_err, finalize_resume, NULL);
 	}
 
 	return TRUE;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 3/3] a2dp: Fix invalid memory access during abort_ind()
From: Syam Sidhardhan @ 2013-01-21 13:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Syam Sidhardhan
In-Reply-To: <1358775211-31005-1-git-send-email-s.syam@samsung.com>

There is an invalid memory access w.r.t to the callback
during the Abort_Ind finalize_setup_errno().

We should terminate the variable arguments with NULL.

Log:
bluetoothd[3353]: audio/avdtp.c:avdtp_parse_cmd() Received ABORT_CMD
bluetoothd[3353]: audio/a2dp.c:abort_ind() Source 0xb6f5ecc8: Abort_Ind
bluetoothd[3353]: audio/a2dp.c:setup_ref() 0xb6f63200: ref=2
bluetoothd[3353]: audio/transport.c:media_transport_remove() Transport
 /org/bluez/3353/hci0/dev_BC_47_60_F5_88_89/fd1 Owner :1.0
bluetoothd[3353]: audio/transport.c:media_transport_release() Transport
 /org/bluez/3353/hci0/dev_BC_47_60_F5_88_89/fd1: read lock released
bluetoothd[3353]: audio/transport.c:media_transport_release() Transport
 /org/bluez/3353/hci0/dev_BC_47_60_F5_88_89/fd1: write lock released
bluetoothd[3353]: audio/transport.c:media_request_reply() Request
 Acquire Reply Input/output error
bluetoothd[3353]: audio/transport.c:media_owner_free() Owner :1.0
bluetoothd[3353]: audio/transport.c:media_owner_remove() Owner :1.0 Request Acquire
bluetoothd[3353]: audio/a2dp.c:a2dp_sep_unlock() SEP 0xb6f5ecc8 unlocked
bluetoothd[3353]: audio/a2dp.c:setup_unref() 0xb6f63200: ref=1
[sys_assert]START of sighandler
[sys-assert]exepath = bluetoothd
[sys-assert]processname = bluetoothd
[sys_assert]this thread is main thread. pid=3353
[sys-assert]cs timestr 1358524835
bluetoothd[3353]: crashed [1358524835] processname=bluetoothd, pid=3353, tid=3353, signal=11
[sys-assert]start print_node_to_file
sighandler = 0xb6e8cfc9, g_sig_oldact[i] = (nil)
[sys_assert]END of sighandler
Segmentation fault (core dumped)
---
 profiles/audio/a2dp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 3c546d9..efb4178 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -957,7 +957,7 @@ static void abort_ind(struct avdtp *session, struct avdtp_local_sep *sep,
 
 	finalize_setup_errno(setup, -ECONNRESET, finalize_suspend,
 							finalize_resume,
-							finalize_config);
+							finalize_config, NULL);
 
 	return;
 }
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ] media: Fix custom property registration for multiple adapters
From: Luiz Augusto von Dentz @ 2013-01-21 13:34 UTC (permalink / raw)
  To: linux-bluetooth

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

The function btd_profile_add_custom_prop register a custom property for
an UUID which is valid for every adapter so its user_data cannot be tied
to a single adapter.

To fix this now NULL is passed as user_data and the callbacks checks if
the adapter passed has been registered and if there is an endpoint for
the UUID requested.
---
 profiles/audio/media.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 15dab8c..0ae9932 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -607,13 +607,28 @@ static gboolean endpoint_init_a2dp_sink(struct media_endpoint *endpoint,
 	return TRUE;
 }
 
+static struct media_adapter *find_adapter(struct btd_device *device)
+{
+	GSList *l;
+
+	for (l = adapters; l; l = l->next) {
+		struct media_adapter *adapter = l->data;
+
+		if (adapter->btd_adapter == device_get_adapter(device))
+			return adapter;
+	}
+
+	return NULL;
+}
+
 static bool endpoint_properties_exists(const char *uuid,
 						struct btd_device *dev,
 						void *user_data)
 {
-	struct media_adapter *adapter = user_data;
+	struct media_adapter *adapter;
 
-	if (adapter->btd_adapter != device_get_adapter(dev))
+	adapter = find_adapter(dev);
+	if (adapter == NULL)
 		return false;
 
 	if (media_adapter_find_endpoint(adapter, NULL, NULL, uuid) == NULL)
@@ -659,10 +674,14 @@ static bool endpoint_properties_get(const char *uuid,
 						DBusMessageIter *iter,
 						void *user_data)
 {
-	struct media_adapter *adapter = user_data;
+	struct media_adapter *adapter;
 	DBusMessageIter dict;
 	GSList *l;
 
+	adapter = find_adapter(dev);
+	if (adapter == NULL)
+		return false;
+
 	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
 					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
 					DBUS_TYPE_STRING_AS_STRING
@@ -743,7 +762,7 @@ static struct media_endpoint *media_endpoint_create(struct media_adapter *adapte
 		btd_profile_add_custom_prop(uuid, "a{sv}", "MediaEndpoints",
 						endpoint_properties_exists,
 						endpoint_properties_get,
-						adapter);
+						NULL);
 	}
 
 	adapter->endpoints = g_slist_append(adapter->endpoints, endpoint);
-- 
1.8.0.2


^ permalink raw reply related

* [PATCH] Check uuid in disconnect profile.
From: Alexandros Antonopoulos @ 2013-01-21 13:44 UTC (permalink / raw)
  To: linux-bluetooth

If the user calls Device1.DisconnectProfile with an invalid profile
uuid disconnect_profile still tries to parse the uuid resulting in
a SIGSEGV

---
 src/device.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/device.c b/src/device.c
index 3675616..1771c0f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1270,6 +1270,9 @@ static DBusMessage *disconnect_profile(DBusConnection *conn, DBusMessage *msg,
 
 	uuid = bt_name2string(pattern);
 
+	if (uuid == NULL)
+		return btd_error_invalid_args(msg);
+
 	p = find_connectable_profile(dev, uuid);
 	g_free(uuid);
 
-- 
1.8.1


^ permalink raw reply related

* [PATCH] avctp: Fix avctp_unregister_browsing_pdu_handler inner loop
From: Alexandros Antonopoulos @ 2013-01-21 13:44 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358775868-9963-1-git-send-email-alexandros.antonopoulos@oss.bmw-carit.de>

Inner loop should access the sessions data and not the servers
data

---
 profiles/audio/avctp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index acce507..eb1d35e 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -1572,7 +1572,7 @@ gboolean avctp_unregister_browsing_pdu_handler(unsigned int id)
 		GSList *s;
 
 		for (s = server->sessions; s; s = s->next) {
-			struct avctp *session = l->data;
+			struct avctp *session = s->data;
 			struct avctp_channel *browsing = session->browsing;
 			GSList *h;
 
-- 
1.8.1


^ permalink raw reply related

* [PATCH] avctp: Fix request timeout after a channel is destroyed
From: Alexandros Antonopoulos @ 2013-01-21 13:44 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358775868-9963-1-git-send-email-alexandros.antonopoulos@oss.bmw-carit.de>

When the control channel is destroyed if there is a pending request
(chan->p) then the channel queue is deleted in avctp_channel_destroy
but the timer is still alive resulting in a SIGSEGV

---
 profiles/audio/avctp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index eb1d35e..e65594d 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -390,6 +390,9 @@ static void avctp_channel_destroy(struct avctp_channel *chan)
 	if (chan->watch)
 		g_source_remove(chan->watch);
 
+	if (chan->p)
+		pending_destroy(chan->p, NULL);
+
 	if (chan->process_id > 0)
 		g_source_remove(chan->process_id);
 
-- 
1.8.1


^ permalink raw reply related

* [PATCH] avctp: Fix size of read() for browsing channel callbacks
From: Alexandros Antonopoulos @ 2013-01-21 13:44 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1358775868-9963-1-git-send-email-alexandros.antonopoulos@oss.bmw-carit.de>

The read() function should attempt to read browsing->imtu bytes
and not sizeof(browsing->imtu).

---
 profiles/audio/avctp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 4309c60..acce507 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -649,7 +649,7 @@ static gboolean session_browsing_cb(GIOChannel *chan, GIOCondition cond,
 
 	sock = g_io_channel_unix_get_fd(chan);
 
-	ret = read(sock, buf, sizeof(browsing->imtu));
+	ret = read(sock, buf, browsing->imtu);
 	if (ret <= 0)
 		goto failed;
 
-- 
1.8.1


^ permalink raw reply related

* [PATCH v4 1/4] Bluetooth: Move discovery state check inside hci_dev_lock()
From: Jaganath Kanakkassery @ 2013-01-21 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery

After checking the discovery state, if other thread modifies it
then it will be overwritten by the assignment in the first thread.

Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
---
 net/bluetooth/hci_event.c |    9 ++++-----
 net/bluetooth/mgmt.c      |    4 ----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 705078a..97b4828 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1273,14 +1273,13 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
 
 		clear_bit(HCI_LE_SCAN, &hdev->dev_flags);
 
+		hci_dev_lock(hdev);
 		if (hdev->discovery.type == DISCOV_TYPE_INTERLEAVED &&
-		    hdev->discovery.state == DISCOVERY_FINDING) {
+		    hdev->discovery.state == DISCOVERY_FINDING)
 			mgmt_interleaved_discovery(hdev);
-		} else {
-			hci_dev_lock(hdev);
+		else
 			hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
-			hci_dev_unlock(hdev);
-		}
+		hci_dev_unlock(hdev);
 
 		break;
 
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 37add53..a7865ad 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2333,14 +2333,10 @@ int mgmt_interleaved_discovery(struct hci_dev *hdev)
 
 	BT_DBG("%s", hdev->name);
 
-	hci_dev_lock(hdev);
-
 	err = hci_do_inquiry(hdev, INQUIRY_LEN_BREDR_LE);
 	if (err < 0)
 		hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
 
-	hci_dev_unlock(hdev);
-
 	return err;
 }
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v4 2/4] Bluetooth: Add mgmt_start_discovery_cancelled()
From: Jaganath Kanakkassery @ 2013-01-21 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery
In-Reply-To: <1358777619-27018-1-git-send-email-jaganath.k@samsung.com>

This function can be used to inform userspace that start discovery
is cancelled

Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
---
 include/net/bluetooth/hci_core.h |    1 +
 net/bluetooth/mgmt.c             |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 014a2ea..d8f68c7 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1112,6 +1112,7 @@ int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 		     u8 addr_type, s8 rssi, u8 *name, u8 name_len);
 int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
+int mgmt_start_discovery_cancelled(struct hci_dev *hdev);
 int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
 int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
 int mgmt_interleaved_discovery(struct hci_dev *hdev);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index a7865ad..3527095 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3722,6 +3722,25 @@ int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status)
 	return err;
 }
 
+int mgmt_start_discovery_cancelled(struct hci_dev *hdev)
+{
+	struct pending_cmd *cmd;
+	u8 type;
+	int err;
+
+	cmd = mgmt_pending_find(MGMT_OP_START_DISCOVERY, hdev);
+	if (!cmd)
+		return -ENOENT;
+
+	type = hdev->discovery.type;
+
+	err = cmd_complete(cmd->sk, hdev->id, cmd->opcode, MGMT_STATUS_CANCELLED,
+			   &type, sizeof(type));
+	mgmt_pending_remove(cmd);
+
+	return err;
+}
+
 int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status)
 {
 	struct pending_cmd *cmd;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v4 3/4] Bluetooth: Change type of "discovering" from u8 to bool
From: Jaganath Kanakkassery @ 2013-01-21 14:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery
In-Reply-To: <1358777619-27018-1-git-send-email-jaganath.k@samsung.com>

Since the only possible values of discovering is 0 and 1, bool is
more appropriate

Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
---
 include/net/bluetooth/hci_core.h |    2 +-
 net/bluetooth/hci_core.c         |    4 ++--
 net/bluetooth/mgmt.c             |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d8f68c7..f20da05 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1114,7 +1114,7 @@ int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status);
 int mgmt_start_discovery_cancelled(struct hci_dev *hdev);
 int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status);
-int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
+int mgmt_discovering(struct hci_dev *hdev, bool discovering);
 int mgmt_interleaved_discovery(struct hci_dev *hdev);
 int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
 int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 596660d..ce6a696 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -326,12 +326,12 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 	switch (state) {
 	case DISCOVERY_STOPPED:
 		if (hdev->discovery.state != DISCOVERY_STARTING)
-			mgmt_discovering(hdev, 0);
+			mgmt_discovering(hdev, false);
 		break;
 	case DISCOVERY_STARTING:
 		break;
 	case DISCOVERY_FINDING:
-		mgmt_discovering(hdev, 1);
+		mgmt_discovering(hdev, true);
 		break;
 	case DISCOVERY_RESOLVING:
 		break;
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3527095..ba5ca81 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3757,7 +3757,7 @@ int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status)
 	return err;
 }
 
-int mgmt_discovering(struct hci_dev *hdev, u8 discovering)
+int mgmt_discovering(struct hci_dev *hdev, bool discovering)
 {
 	struct mgmt_ev_discovering ev;
 	struct pending_cmd *cmd;
-- 
1.7.9.5


^ permalink raw reply related


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