Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] build: Fix 'make distcheck'
From: Vinicius Costa Gomes @ 2012-12-07  0:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes, johan.hedberg

The test script of the cycling speed profile should be
'test-cyclingspeed' instead of 'test-cycling'.
---
 Makefile.tools | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.tools b/Makefile.tools
index 90b35d5..a6ce5b2 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -221,4 +221,4 @@ EXTRA_DIST += test/sap_client.py test/hsplay test/hsmicro test/bluezutils.py \
 		test/service-did.xml test/service-spp.xml test/service-opp.xml \
 		test/service-ftp.xml test/simple-player test/test-nap \
 		test/test-heartrate test/test-alert test/test-hfp \
-		test/test-cycling
+		test/test-cyclingspeed
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 3/3] adapter: Discoverable storage
From: Andre Guedes @ 2012-12-06 23:41 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354837273-31712-1-git-send-email-andre.guedes@openbossa.org>

This patch changes store_adapter_info helper so it stores Discoverable
value according to discov_timeout. If discov_timeout is greater than
zero, we store "false" for Discoverable. This change covers the case
when DiscoverableTimeout value is set when Discoverable is true.
---
 src/adapter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 35a4715..fb6c570 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -231,7 +231,8 @@ static void store_adapter_info(struct btd_adapter *adapter)
 					adapter->pairable_timeout);
 
 	g_key_file_set_boolean(key_file, "General", "Discoverable",
-				adapter->discoverable);
+				adapter->discov_timeout ?
+				FALSE : adapter->discoverable);
 
 	if (adapter->discov_timeout != main_opts.discovto)
 		g_key_file_set_integer(key_file, "General",
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 2/3] adapter: Don't store Discoverable value if DiscoverableTimeout is set
From: Andre Guedes @ 2012-12-06 23:41 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354837273-31712-1-git-send-email-andre.guedes@openbossa.org>

If adapter was set to Discoverable and DiscoverableTimeout is greater
than zero we should not store the Discoverable adapter info as long as
it is a non-persistent state. This way, we don't need to worry about
updating the Discoverable stored value once the timeout expires.
---
 src/adapter.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/adapter.c b/src/adapter.c
index 25501c4..35a4715 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2269,8 +2269,12 @@ static void set_mode_complete(struct btd_adapter *adapter)
 	if (err != 0)
 		error("unable to set mode: %s", mode2str(pending->mode));
 
+	if (adapter->mode == MODE_DISCOVERABLE && adapter->discov_timeout > 0)
+		goto done;
+
 	store_adapter_info(adapter);
 
+done:
 	session_unref(pending);
 }
 
-- 
1.8.0.1


^ permalink raw reply related

* [PATCH BlueZ 1/3] adapter: Fix unplugging adapter bug
From: Andre Guedes @ 2012-12-06 23:41 UTC (permalink / raw)
  To: linux-bluetooth

If we unplug an adapter in powered on state, once it is plugged
again, it doesn't go to powered on state as expected. This bug
happens because Powered info is stored when the adapter is
unplugged from the system.

This patch fixes this bug by only storing adapter info if mode
changing was requested by user application via D-Bus interface.
This patch basically reverts the changes in commit
985d8ac397a7c332c1badcb95430a167ec93e9e7 where the bug was
introduced.
---
 src/adapter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 0a0e6f0..25501c4 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2230,8 +2230,6 @@ static void set_mode_complete(struct btd_adapter *adapter)
 	struct session_req *pending;
 	int err;
 
-	store_adapter_info(adapter);
-
 	DBG("%s", mode2str(adapter->mode));
 
 	if (adapter->mode == MODE_OFF) {
@@ -2271,6 +2269,8 @@ static void set_mode_complete(struct btd_adapter *adapter)
 	if (err != 0)
 		error("unable to set mode: %s", mode2str(pending->mode));
 
+	store_adapter_info(adapter);
+
 	session_unref(pending);
 }
 
-- 
1.8.0.1


^ permalink raw reply related

* hidp bug concerning ctrl_sk sock
From: Karl Relton @ 2012-12-06 21:23 UTC (permalink / raw)
  To: linux-bluetooth

With reference to bug https://bugzilla.kernel.org/show_bug.cgi?id=50541
it seems to me that the hidp driver has a problem in the hidp_session()
function.

The sock structure pointed to by ctrl_sk is being freed from under the
functions feet (as far as I can see), causing this function to crash.
Shouldn't a lock_sock or sock_hold be necessary to keep the sock
structure around until hidp_session has finished with it?




^ permalink raw reply

* hidp bug concerning ctrl_sk sock
From: Karl Relton @ 2012-12-06 21:04 UTC (permalink / raw)
  To: linux-bluetooth

With reference to bug https://bugzilla.kernel.org/show_bug.cgi?id=50541
it seems to me that the hidp driver has a problem in the hidp_session()
function.

The sock structure pointed to by ctrl_sk is being freed from under the
functions feet (as far as I can see), causing this function to crash.
Shouldn't a lock_sock or sock_hold be necessary to keep the sock
structure around until hidp_session has finished with it?



^ permalink raw reply

* Re: [PATCH BlueZ] test: Fix syntax in bluezutils.py
From: Johan Hedberg @ 2012-12-06 20:26 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth, Frédéric Danis
In-Reply-To: <1354824780-21903-1-git-send-email-vinicius.gomes@openbossa.org>

Hi,

On Thu, Dec 06, 2012, Vinicius Costa Gomes wrote:
> Traceback (most recent call last):
>   File "./simple-agent", line 12, in <module>
>     import bluezutils
>   File "/home/fdanis/src/bluez/test/bluezutils.py", line 22
>     if not pattern or pattern == adapter["Address"] or
>                                                      ^
> SyntaxError: invalid syntax
> ---
>  test/bluezutils.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] Fixes kernel oops when turning bluetooth mouse on
From: Gustavo Padovan @ 2012-12-06 20:24 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Lamarque V. Souza, linux-input, linux-kernel, linux-bluetooth
In-Reply-To: <alpine.LNX.2.00.1212061548430.28002@pobox.suse.cz>

Hi Jiri,

* Jiri Kosina <jkosina@suse.cz> [2012-12-06 15:50:48 +0100]:

> On Thu, 6 Dec 2012, Lamarque V. Souza wrote:
> 
> > This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the 
> > bluetooth mouse with id 0458:0058 [1].
> > 
> > The mouse in question supports both input and hid sessions, however it is 
> > blacklisted in drivers/hid/hid-core.c so the input session is one that should 
> > be used. Long ago (around kernel 3.0.0) some changes in the bluetooth 
> > subsystem made the kernel do not fallback to input session when hid session is 
> > not supported or blacklisted. This patch restore that behaviour by making the 
> > kernel try the input session if hid_add_device returns ENODEV.
> > 
> > OBS: The patch exports hid_ignore() from hid-core.c so that it can be used in 
> > the bluetooth subsystem.
> > 
> > [1] https://bugzilla.kernel.org/show_bug.cgi?id=39882
> > 
> > Signed-off-by: Lamarque V. Souza <lamarque@gmail.com>
> 
> I am fine with the hid core change. Adding Gustavo and linux-bluetooth@ 
> for the net/bluetooth/hidp/ change ... Gustavo, could you please give me 
> Ack on the Bluetooth part so that I could merge it?
> 
> Thanks.
> 
> > ---
> > 
> > diff -Nrup a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> > --- a/drivers/hid/hid-core.c	2012-12-05 01:43:45.000000000 -0200
> > +++ b/drivers/hid/hid-core.c	2012-12-05 01:26:57.000000000 -0200
> > @@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo
> >  	{ }
> >  };
> >  
> > -static bool hid_ignore(struct hid_device *hdev)
> > +bool hid_ignore(struct hid_device *hdev)
> >  {
> > +	if (hdev->quirks & HID_QUIRK_NO_IGNORE)
> > +		return false;
> > +	if (hdev->quirks & HID_QUIRK_IGNORE)
> > +		return true;
> > +
> >  	switch (hdev->vendor) {
> >  	case USB_VENDOR_ID_CODEMERCS:
> >  		/* ignore all Code Mercenaries IOWarrior devices */
> > @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_device
> >  
> >  	return !!hid_match_id(hdev, hid_ignore_list);
> >  }
> > +EXPORT_SYMBOL_GPL(hid_ignore);
> >  
> >  int hid_add_device(struct hid_device *hdev)
> >  {
> > @@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd
> >  
> >  	/* we need to kill them here, otherwise they will stay allocated to
> >  	 * wait for coming driver */
> > -	if (!(hdev->quirks & HID_QUIRK_NO_IGNORE)
> > -            && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE)))
> > +	if (hid_ignore(hdev))
> >  		return -ENODEV;
> >  
> >  	/*
> > diff -Nrup a/include/linux/hid.h b/include/linux/hid.h
> > --- a/include/linux/hid.h	2012-12-05 01:44:14.000000000 -0200
> > +++ b/include/linux/hid.h	2012-12-05 01:26:57.000000000 -0200
> > @@ -684,6 +684,7 @@ struct hid_ll_driver {
> >  
> >  extern int hid_debug;
> >  
> > +extern bool hid_ignore(struct hid_device *);
> >  extern int hid_add_device(struct hid_device *);
> >  extern void hid_destroy_device(struct hid_device *);
> >  
> > diff -Nrup a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
> > --- a/net/bluetooth/hidp/core.c	2012-12-05 01:43:15.000000000 -0200
> > +++ b/net/bluetooth/hidp/core.c	2012-12-05 02:29:49.000000000 -0200
> > @@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se
> >  	hid->hid_get_raw_report = hidp_get_raw_report;
> >  	hid->hid_output_raw_report = hidp_output_raw_report;
> >  
> > +	/* True if device is blacklisted in drivers/hid/hid-core.c */
> > +	if (hid_ignore(hid)) {
> > +		hid_destroy_device(session->hid);
> > +		session->hid = NULL;
> > +		return -ENODEV;
> > +	}
> > +
> >  	return 0;
> >  
> >  fault:
> > @@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_conn
> >  
> >  	if (req->rd_size > 0) {
> >  		err = hidp_setup_hid(session, req);
> > -		if (err)
> > +		if (err && err != -ENODEV)
> >  			goto purge;
> >  	}

Acked-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

	Gustavo

^ permalink raw reply

* [PATCH BlueZ] test: Fix syntax in bluezutils.py
From: Vinicius Costa Gomes @ 2012-12-06 20:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frédéric Danis, johan.hedberg

From: Frédéric Danis <frederic.danis@linux.intel.com>

Traceback (most recent call last):
  File "./simple-agent", line 12, in <module>
    import bluezutils
  File "/home/fdanis/src/bluez/test/bluezutils.py", line 22
    if not pattern or pattern == adapter["Address"] or
                                                     ^
SyntaxError: invalid syntax
---
 test/bluezutils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/bluezutils.py b/test/bluezutils.py
index d0c4773..de08cbd 100644
--- a/test/bluezutils.py
+++ b/test/bluezutils.py
@@ -19,8 +19,8 @@ def find_adapter_in_objects(objects, pattern=None):
 		adapter = ifaces.get(ADAPTER_INTERFACE)
 		if adapter is None:
 			continue
-		if not pattern or pattern == adapter["Address"] or
-							path.endswith(pattern)):
+		if not pattern or pattern == adapter["Address"] or \
+							path.endswith(pattern):
 			obj = bus.get_object(SERVICE_NAME, path)
 			return dbus.Interface(obj, ADAPTER_INTERFACE)
 	raise Exception("Bluetooth adapter not found")
-- 
1.8.0.1


^ permalink raw reply related

* CC2540 LE thermometer sample code
From: Elvis Pfutzenreuter @ 2012-12-06 18:17 UTC (permalink / raw)
  To: linux-bluetooth

I hammered the thermometer sample code that comes with CC2540 SDK until
it worked marginally with BlueZ.

FWIW, in case someone wants to use it for testing:

http://oss.signove.com/index.php/CC2540Thermometer

^ permalink raw reply

* PulseAudio branch to test BlueZ master
From: Mikel Astiz @ 2012-12-06 16:03 UTC (permalink / raw)
  To: linux-bluetooth

Hi all,

It's been recently quite hard to test the audio part of BlueZ without
having an updated PulseAudio which keeps up with the new D-Bus API in
BlueZ.

I've been doing some work to solve this and here you have the result:
git://github.com/mastiz/pulseaudio-bluez5.git

It's a big patchset on top of Tanu's next branch for PulseAudio. Only
the last patches are related to BlueZ 5, and the rest should slowly
get merged into PA master, in some way or another (first patches
already submitted upstream).

I warn you that it's not going to be stable in general, and in
particular I haven't done any testing with oFono. So I'd expect quite
a few issues.

Consider this work-in-progress and note that it will get rebased
periodically on top of Tanu's tree. If you have any feedback or code
contributions, I'd suggest you contact me directly.

Cheers,
Mikel

^ permalink raw reply

* Re: [PATCH] test: Fix test-device using wrong interface
From: Johan Hedberg @ 2012-12-06 15:42 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz
In-Reply-To: <1354800883-31456-1-git-send-email-mikel.astiz.oss@gmail.com>

Hi Mikel,

On Thu, Dec 06, 2012, Mikel Astiz wrote:
> The property getter and setter belong to org.freedesktop.DBus.Properties
> and therefore fix this code using the wrong interface since commit
> 67dab2d2aeec9ab895da6afd528ec0c63e657ff4.
> ---
>  test/test-device | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH] Fixes kernel oops when turning bluetooth mouse on
From: Jiri Kosina @ 2012-12-06 14:50 UTC (permalink / raw)
  To: Lamarque V. Souza
  Cc: linux-input, linux-kernel, Gustavo Padovan, linux-bluetooth
In-Reply-To: <201212061239.55610.lamarque@gmail.com>

On Thu, 6 Dec 2012, Lamarque V. Souza wrote:

> This patch against kernel 3.7.0-rc8 fixes a kernel oops when turning on the 
> bluetooth mouse with id 0458:0058 [1].
> 
> The mouse in question supports both input and hid sessions, however it is 
> blacklisted in drivers/hid/hid-core.c so the input session is one that should 
> be used. Long ago (around kernel 3.0.0) some changes in the bluetooth 
> subsystem made the kernel do not fallback to input session when hid session is 
> not supported or blacklisted. This patch restore that behaviour by making the 
> kernel try the input session if hid_add_device returns ENODEV.
> 
> OBS: The patch exports hid_ignore() from hid-core.c so that it can be used in 
> the bluetooth subsystem.
> 
> [1] https://bugzilla.kernel.org/show_bug.cgi?id=39882
> 
> Signed-off-by: Lamarque V. Souza <lamarque@gmail.com>

I am fine with the hid core change. Adding Gustavo and linux-bluetooth@ 
for the net/bluetooth/hidp/ change ... Gustavo, could you please give me 
Ack on the Bluetooth part so that I could merge it?

Thanks.

> ---
> 
> diff -Nrup a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> --- a/drivers/hid/hid-core.c	2012-12-05 01:43:45.000000000 -0200
> +++ b/drivers/hid/hid-core.c	2012-12-05 01:26:57.000000000 -0200
> @@ -2150,8 +2150,13 @@ static const struct hid_device_id hid_mo
>  	{ }
>  };
>  
> -static bool hid_ignore(struct hid_device *hdev)
> +bool hid_ignore(struct hid_device *hdev)
>  {
> +	if (hdev->quirks & HID_QUIRK_NO_IGNORE)
> +		return false;
> +	if (hdev->quirks & HID_QUIRK_IGNORE)
> +		return true;
> +
>  	switch (hdev->vendor) {
>  	case USB_VENDOR_ID_CODEMERCS:
>  		/* ignore all Code Mercenaries IOWarrior devices */
> @@ -2197,6 +2202,7 @@ static bool hid_ignore(struct hid_device
>  
>  	return !!hid_match_id(hdev, hid_ignore_list);
>  }
> +EXPORT_SYMBOL_GPL(hid_ignore);
>  
>  int hid_add_device(struct hid_device *hdev)
>  {
> @@ -2208,8 +2214,7 @@ int hid_add_device(struct hid_device *hd
>  
>  	/* we need to kill them here, otherwise they will stay allocated to
>  	 * wait for coming driver */
> -	if (!(hdev->quirks & HID_QUIRK_NO_IGNORE)
> -            && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE)))
> +	if (hid_ignore(hdev))
>  		return -ENODEV;
>  
>  	/*
> diff -Nrup a/include/linux/hid.h b/include/linux/hid.h
> --- a/include/linux/hid.h	2012-12-05 01:44:14.000000000 -0200
> +++ b/include/linux/hid.h	2012-12-05 01:26:57.000000000 -0200
> @@ -684,6 +684,7 @@ struct hid_ll_driver {
>  
>  extern int hid_debug;
>  
> +extern bool hid_ignore(struct hid_device *);
>  extern int hid_add_device(struct hid_device *);
>  extern void hid_destroy_device(struct hid_device *);
>  
> diff -Nrup a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
> --- a/net/bluetooth/hidp/core.c	2012-12-05 01:43:15.000000000 -0200
> +++ b/net/bluetooth/hidp/core.c	2012-12-05 02:29:49.000000000 -0200
> @@ -941,6 +941,13 @@ static int hidp_setup_hid(struct hidp_se
>  	hid->hid_get_raw_report = hidp_get_raw_report;
>  	hid->hid_output_raw_report = hidp_output_raw_report;
>  
> +	/* True if device is blacklisted in drivers/hid/hid-core.c */
> +	if (hid_ignore(hid)) {
> +		hid_destroy_device(session->hid);
> +		session->hid = NULL;
> +		return -ENODEV;
> +	}
> +
>  	return 0;
>  
>  fault:
> @@ -1013,7 +1020,7 @@ int hidp_add_connection(struct hidp_conn
>  
>  	if (req->rd_size > 0) {
>  		err = hidp_setup_hid(session, req);
> -		if (err)
> +		if (err && err != -ENODEV)
>  			goto purge;
>  	}
>  
> 

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply

* Re: [PATCH] test: Fix syntax in bluezutils.py
From: Vinicius Costa Gomes @ 2012-12-06 14:29 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth
In-Reply-To: <1354797576-11286-1-git-send-email-frederic.danis@linux.intel.com>

Hi,

On 13:39 Thu 06 Dec, Frédéric Danis wrote:
> Traceback (most recent call last):
>   File "./simple-agent", line 12, in <module>
>     import bluezutils
>   File "/home/fdanis/src/bluez/test/bluezutils.py", line 22
>     if not pattern or pattern == adapter["Address"] or
>                                                      ^
> SyntaxError: invalid syntax
> ---
>  test/bluezutils.py |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/test/bluezutils.py b/test/bluezutils.py
> index d0c4773..de08cbd 100644
> --- a/test/bluezutils.py
> +++ b/test/bluezutils.py
> @@ -19,8 +19,8 @@ def find_adapter_in_objects(objects, pattern=None):
>  		adapter = ifaces.get(ADAPTER_INTERFACE)
>  		if adapter is None:
>  			continue
> -		if not pattern or pattern == adapter["Address"] or
> -							path.endswith(pattern)):
> +		if not pattern or pattern == adapter["Address"] or \
> +							path.endswith(pattern):

Ack.


Cheers,
-- 
Vinicius

^ permalink raw reply

* [PATCH] test: Fix test-device using wrong interface
From: Mikel Astiz @ 2012-12-06 13:34 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: johan.hedberg, Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

The property getter and setter belong to org.freedesktop.DBus.Properties
and therefore fix this code using the wrong interface since commit
67dab2d2aeec9ab895da6afd528ec0c63e657ff4.
---
 test/test-device | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/test/test-device b/test/test-device
index 655eeae..2be5394 100755
--- a/test/test-device
+++ b/test/test-device
@@ -140,9 +140,10 @@ if (args[0] == "class"):
 		print("Need address parameter")
 	else:
 		device = bluezutils.find_device(args[1], options.dev_id)
-		device = dbus.Interface(bus.get_object("org.bluez", path),
+		path = device.object_path
+		props = dbus.Interface(bus.get_object("org.bluez", path),
 					"org.freedesktop.DBus.Properties")
-		cls = device.Get("org.bluez.Device1", "Class")
+		cls = props.Get("org.bluez.Device1", "Class")
 		print("0x%06x" % cls)
 	sys.exit(0)
 
@@ -167,10 +168,10 @@ if (args[0] == "alias"):
 		props = dbus.Interface(bus.get_object("org.bluez", path),
 					"org.freedesktop.DBus.Properties")
 		if (len(args) < 3):
-			alias = device.Get("org.bluez.Device1", "Alias")
+			alias = props.Get("org.bluez.Device1", "Alias")
 			print(alias)
 		else:
-			device.Set("org.bluez.Device1", "Alias", args[2])
+			props.Set("org.bluez.Device1", "Alias", args[2])
 	sys.exit(0)
 
 if (args[0] == "trusted"):
@@ -182,7 +183,7 @@ if (args[0] == "trusted"):
 		props = dbus.Interface(bus.get_object("org.bluez", path),
 					"org.freedesktop.DBus.Properties")
 		if (len(args) < 3):
-			trusted = device.Get("org.bluez.Device1", "Trusted")
+			trusted = props.Get("org.bluez.Device1", "Trusted")
 			print(trusted)
 		else:
 			if (args[2] == "yes"):
@@ -191,7 +192,7 @@ if (args[0] == "trusted"):
 				value = dbus.Boolean(0)
 			else:
 				value = dbus.Boolean(args[2])
-			device.Set("org.bluez.Device1", "Trusted", value)
+			props.Set("org.bluez.Device1", "Trusted", value)
 	sys.exit(0)
 
 if (args[0] == "blocked"):
@@ -203,7 +204,7 @@ if (args[0] == "blocked"):
 		props = dbus.Interface(bus.get_object("org.bluez", path),
 					"org.freedesktop.DBus.Properties")
 		if (len(args) < 3):
-			blocked = device.Get("org.bluez.Device1", "Blocked")
+			blocked = props.Get("org.bluez.Device1", "Blocked")
 			print(blocked)
 		else:
 			if (args[2] == "yes"):
@@ -212,7 +213,7 @@ if (args[0] == "blocked"):
 				value = dbus.Boolean(0)
 			else:
 				value = dbus.Boolean(args[2])
-			device.Set("org.bluez.Device1", "Blocked", value)
+			props.Set("org.bluez.Device1", "Blocked", value)
 	sys.exit(0)
 
 if (args[0] == "services"):
@@ -223,7 +224,7 @@ if (args[0] == "services"):
 		path = device.object_path
 		props = dbus.Interface(bus.get_object("org.bluez", path),
 					"org.freedesktop.DBus.Properties")
-		services = device.Get("org.bluez.Device1", "Services")
+		services = props.Get("org.bluez.Device1", "Services")
 		for path in services:
 			print(path)
 	sys.exit(0)
-- 
1.7.11.7


^ permalink raw reply related

* [PATCH] test: Fix syntax in bluezutils.py
From: Frédéric Danis @ 2012-12-06 12:39 UTC (permalink / raw)
  To: linux-bluetooth

Traceback (most recent call last):
  File "./simple-agent", line 12, in <module>
    import bluezutils
  File "/home/fdanis/src/bluez/test/bluezutils.py", line 22
    if not pattern or pattern == adapter["Address"] or
                                                     ^
SyntaxError: invalid syntax
---
 test/bluezutils.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/bluezutils.py b/test/bluezutils.py
index d0c4773..de08cbd 100644
--- a/test/bluezutils.py
+++ b/test/bluezutils.py
@@ -19,8 +19,8 @@ def find_adapter_in_objects(objects, pattern=None):
 		adapter = ifaces.get(ADAPTER_INTERFACE)
 		if adapter is None:
 			continue
-		if not pattern or pattern == adapter["Address"] or
-							path.endswith(pattern)):
+		if not pattern or pattern == adapter["Address"] or \
+							path.endswith(pattern):
 			obj = bus.get_object(SERVICE_NAME, path)
 			return dbus.Interface(obj, ADAPTER_INTERFACE)
 	raise Exception("Bluetooth adapter not found")
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 3/3 v1] Bluetooth: Fix stop discovery while in STARTING state
From: Jaganath Kanakkassery @ 2012-12-06 11:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery
In-Reply-To: <1354791958-28334-1-git-send-email-jaganath.k@samsung.com>

If stop_discovery() is called when discovery state is STARTING, it
will be failed currently. This patch fixes this.

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

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index bd63a9f..d09777a 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -64,6 +64,7 @@ struct discovery_state {
 		DISCOVERY_RESOLVING,
 		DISCOVERY_STOPPING,
 	} state;
+	int prev_state;
 	struct list_head	all;	/* All devices found during inquiry */
 	struct list_head	unknown;	/* Name state not known */
 	struct list_head	resolve;	/* Name needs to be resolved */
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c6c67b2..93d0261 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -391,7 +391,13 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 
 	switch (state) {
 	case DISCOVERY_STOPPED:
-		if (hdev->discovery.state != DISCOVERY_STARTING)
+		if (hdev->discovery.state == DISCOVERY_STARTING)
+			break;
+
+		if (hdev->discovery.state == DISCOVERY_STOPPING &&
+		    hdev->discovery.prev_state == DISCOVERY_STARTING)
+			mgmt_stop_discovery_complete(hdev, 0);
+		else
 			mgmt_discovering(hdev, 0);
 		break;
 	case DISCOVERY_STARTING:
@@ -405,6 +411,7 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
 		break;
 	}
 
+	hdev->discovery.prev_state = hdev->discovery.state;
 	hdev->discovery.state = state;
 }
 
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 1fadba5..3f9f317 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1085,6 +1085,8 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
 		if (status) {
 			hci_dev_lock(hdev);
 			mgmt_start_discovery_failed(hdev, status);
+			if (hdev->discovery.state == DISCOVERY_STOPPING)
+				mgmt_stop_discovery_complete(hdev, status);
 			hci_dev_unlock(hdev);
 			return;
 		}
@@ -1092,7 +1094,10 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
 		set_bit(HCI_LE_SCAN, &hdev->dev_flags);
 
 		hci_dev_lock(hdev);
-		hci_discovery_set_state(hdev, DISCOVERY_FINDING);
+		if (hdev->discovery.state == DISCOVERY_STOPPING)
+			hci_cancel_le_scan(hdev);
+		else
+			hci_discovery_set_state(hdev, DISCOVERY_FINDING);
 		hci_dev_unlock(hdev);
 		break;
 
@@ -1180,8 +1185,11 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
 		hci_req_complete(hdev, HCI_OP_INQUIRY, status);
 		hci_conn_check_pending(hdev);
 		hci_dev_lock(hdev);
-		if (test_bit(HCI_MGMT, &hdev->dev_flags))
+		if (test_bit(HCI_MGMT, &hdev->dev_flags)) {
 			mgmt_start_discovery_failed(hdev, status);
+			if (hdev->discovery.state == DISCOVERY_STOPPING)
+				mgmt_stop_discovery_complete(hdev, status);
+		}
 		hci_dev_unlock(hdev);
 		return;
 	}
@@ -1189,6 +1197,9 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
 	set_bit(HCI_INQUIRY, &hdev->flags);
 
 	hci_dev_lock(hdev);
+	if (hdev->discovery.state == DISCOVERY_STOPPING)
+		hci_cancel_inquiry(hdev);
+	else
 	hci_discovery_set_state(hdev, DISCOVERY_FINDING);
 	hci_dev_unlock(hdev);
 }
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 332152b..a645494 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2387,6 +2387,11 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
 
 	hci_dev_lock(hdev);
 
+	if (hdev->discovery.state == DISCOVERY_STARTING) {
+		err = 0;
+		goto proceed;
+	}
+
 	if (!hci_discovery_active(hdev)) {
 		err = cmd_complete(sk, hdev->id, MGMT_OP_STOP_DISCOVERY,
 				   MGMT_STATUS_REJECTED, &mgmt_cp->type,
@@ -2401,6 +2406,7 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
 		goto unlock;
 	}
 
+proceed:
 	cmd = mgmt_pending_add(sk, MGMT_OP_STOP_DISCOVERY, hdev, NULL, 0);
 	if (!cmd) {
 		err = -ENOMEM;
@@ -2435,6 +2441,9 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data,
 
 		break;
 
+	case DISCOVERY_STARTING:
+		break;
+
 	default:
 		BT_DBG("unknown discovery state %u", hdev->discovery.state);
 		err = -EFAULT;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/3 v1] Bluetooth: Move discovery state check inside hci_dev_lock()
From: Jaganath Kanakkassery @ 2012-12-06 11:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery
In-Reply-To: <1354791958-28334-1-git-send-email-jaganath.k@samsung.com>

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 e859851..1fadba5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1106,14 +1106,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 b4bba68..332152b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2291,14 +2291,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 1/3 v1] Bluetooth: Rename stop_discovery_failed() to stop_discovery_complete()
From: Jaganath Kanakkassery @ 2012-12-06 11:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery
In-Reply-To: <1354791958-28334-1-git-send-email-jaganath.k@samsung.com>

This renaming has done since in success case also this function can
be used to send complete event

Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
---
 include/net/bluetooth/hci_core.h |    2 +-
 net/bluetooth/hci_event.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 119fcb6..bd63a9f 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1066,7 +1066,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_stop_discovery_failed(struct hci_dev *hdev, u8 status);
+int mgmt_stop_discovery_complete(struct hci_dev *hdev, u8 status);
 int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
 int mgmt_interleaved_discovery(struct hci_dev *hdev);
 int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9fb656b..e859851 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -40,7 +40,7 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb)
 
 	if (status) {
 		hci_dev_lock(hdev);
-		mgmt_stop_discovery_failed(hdev, status);
+		mgmt_stop_discovery_complete(hdev, status);
 		hci_dev_unlock(hdev);
 		return;
 	}
@@ -1099,7 +1099,7 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
 	case LE_SCANNING_DISABLED:
 		if (status) {
 			hci_dev_lock(hdev);
-			mgmt_stop_discovery_failed(hdev, status);
+			mgmt_stop_discovery_complete(hdev, status);
 			hci_dev_unlock(hdev);
 			return;
 		}
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index dc5698c..b4bba68 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3630,7 +3630,7 @@ int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status)
 	return err;
 }
 
-int mgmt_stop_discovery_failed(struct hci_dev *hdev, u8 status)
+int mgmt_stop_discovery_complete(struct hci_dev *hdev, u8 status)
 {
 	struct pending_cmd *cmd;
 	int err;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 0/3 v1] Fix stop discovery not handled if discovery state is STARTING
From: Jaganath Kanakkassery @ 2012-12-06 11:05 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jaganath Kanakkassery

If user calls stop_discovery when the discovery state is STARTING, then it fails.
In this scenario discovery will continue. 

This patch handles stop_discovery even if state is STARTING

Jaganath Kanakkassery (3):
  Bluetooth: Rename stop_discovery_failed() to
    stop_discovery_complete()
  Bluetooth: Move discovery state check inside hci_dev_lock()
  Bluetooth: Fix stop discovery while in STARTING state

 include/net/bluetooth/hci_core.h |    3 ++-
 net/bluetooth/hci_core.c         |    9 ++++++++-
 net/bluetooth/hci_event.c        |   28 +++++++++++++++++++---------
 net/bluetooth/mgmt.c             |   15 ++++++++++-----
 4 files changed, 39 insertions(+), 16 deletions(-)

-- 
1.7.9.5


^ permalink raw reply

* Re: BLE issue: Start_LE_Encryption fails
From: Anderson Lizardo @ 2012-12-06 10:50 UTC (permalink / raw)
  To: Ajay; +Cc: linux-bluetooth
In-Reply-To: <50BE45BB.409@globaledgesoft.com>

Hi Ajay,

On Tue, Dec 4, 2012 at 2:49 PM, Ajay <ajay.kv@globaledgesoft.com> wrote:
> SLAVE side
>
> root@test:/home#  hcitool -i hci0 cmd 0x08 0x0008 03 02 01 06 \
>
>                         $(perl -e 'print "00 " x 28')
> root@test:/home# hciconfig hci0  leadv
>
>
> Hcidump shows ..
>
> < HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
>> HCI Event: Command Complete (0x0e) plen 4
>     LE Set Advertising Data (0x08|0x0008) ncmd 1
>     status 0x00
> < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
>> HCI Event: Command Complete (0x0e) plen 4
>     LE Set Advertise Enable (0x08|0x000a) ncmd 1
>     status 0x00
>
>> HCI Event: LE Meta Event (0x3e) plen 19
>     LE Connection Complete
>       status 0x00 handle 64, role slave
>       bdaddr 00:02:72:D6:AB:AD (Public)
>> ACL data: handle 64 flags 0x02 dlen 11
>     ATT: Read By Group req (0x10)
>       start 0x0001, end 0xffff
>       type-uuid 0x2800

Your slave device is not answering to the Read By Group request,
therefore the master side is disconnecting due to timeout.

I suggest you first try using gatttool on the master side to connect
to the slave, and run "primary" to see if it is processing GATT
requests.

The bluez log from the slave side should help (I assume you are
running BlueZ on the slave side).

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

^ permalink raw reply

* Re: [PATCH] media: Fix some wrong interface names
From: Johan Hedberg @ 2012-12-06 10:42 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1354778750-13214-1-git-send-email-mikel.astiz.oss@gmail.com>

Hi Mikel,

On Thu, Dec 06, 2012, Mikel Astiz wrote:
> Trivially fix some wrong interface names introduced by commit
> 3aa15b56dca27a73f6bc34467ba0ce4c85ee2d9a.
> ---
>  doc/media-api.txt      | 4 ++--
>  profiles/audio/media.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH BlueZ] lib: Fix member type on le_read_advertising_channel_tx_power_rp
From: Johan Hedberg @ 2012-12-06 10:24 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1354756970-13214-1-git-send-email-anderson.lizardo@openbossa.org>

Hi Lizardo,

On Wed, Dec 05, 2012, Anderson Lizardo wrote:
> Transmit power level range is -20 <= N <= 10, thus it should be stored
> as int8_t.
> ---
>  lib/hci.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH BlueZ] audio: Fix interface names
From: Johan Hedberg @ 2012-12-06 10:24 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth
In-Reply-To: <1354749489-25442-1-git-send-email-vinicius.gomes@openbossa.org>

Hi Vinicius,

On Wed, Dec 05, 2012, Vinicius Costa Gomes wrote:
> In some places, the old names of the interfaces were still being used.
> So we update them to use the new names.
> ---
> Hi,
> 
> This patch is more to confirm the intended names, in this patch I am
> supposing that the correct names are 'org.bluez.MediaEndpoint1' and
> 'org.bluez.MediaPlayer1'. As I think that the double numbering would
> cause even more confusion.
> 
> Cheers,
> 
>  src/bluetooth.conf   |  4 ++--
>  test/simple-endpoint | 10 +++++-----
>  test/simple-player   | 10 +++++-----
>  3 files changed, 12 insertions(+), 12 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply

* [PATCH] media: Fix some wrong interface names
From: Mikel Astiz @ 2012-12-06  7:25 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

Trivially fix some wrong interface names introduced by commit
3aa15b56dca27a73f6bc34467ba0ce4c85ee2d9a.
---
 doc/media-api.txt      | 4 ++--
 profiles/audio/media.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index ce7502a..1865df9 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -128,7 +128,7 @@ MediaPlayer1 hierarchy
 
 Service		unique name (Target role)
 		org.bluez (Controller role)
-Interface	org.bluez.Media1Player1
+Interface	org.bluez.MediaPlayer1
 Object path	freely definable (Target role)
 		[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
 		(Controller role)
@@ -223,7 +223,7 @@ MediaEndpoint1 hierarchy
 ========================
 
 Service		unique name
-Interface	org.bluez.Media1Endpoint1
+Interface	org.bluez.MediaEndpoint1
 Object path	freely definable
 
 Methods		void SetConfiguration(object transport, dict properties)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 61c1f03..4c5d38b 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -47,7 +47,7 @@
 #include "manager.h"
 
 #define MEDIA_INTERFACE "org.bluez.Media1"
-#define MEDIA_ENDPOINT_INTERFACE "org.bluez.Media1Endpoint1"
+#define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint1"
 #define MEDIA_PLAYER_INTERFACE "org.bluez.MediaPlayer1"
 
 #define REQUEST_TIMEOUT (3 * 1000)		/* 3 seconds */
-- 
1.7.11.7


^ 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