Linux bluetooth development
 help / color / mirror / Atom feed
* 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

* [PATCH BlueZ] lib: Fix member type on le_read_advertising_channel_tx_power_rp
From: Anderson Lizardo @ 2012-12-06  1:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

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(-)

diff --git a/lib/hci.h b/lib/hci.h
index 2f18ec8..196b1aa 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -1492,7 +1492,7 @@ typedef struct {
 #define OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER	0x0007
 typedef struct {
 	uint8_t		status;
-	uint8_t		level;
+	int8_t		level;
 } __attribute__ ((packed)) le_read_advertising_channel_tx_power_rp;
 #define LE_READ_ADVERTISING_CHANNEL_TX_POWER_RP_SIZE 2
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH BlueZ] audio: Fix interface names
From: Vinicius Costa Gomes @ 2012-12-05 23:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

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(-)

diff --git a/src/bluetooth.conf b/src/bluetooth.conf
index 4d0d504..6111fdb 100644
--- a/src/bluetooth.conf
+++ b/src/bluetooth.conf
@@ -12,8 +12,8 @@
     <allow send_destination="org.bluez"/>
     <allow send_interface="org.bluez.Agent"/>
     <allow send_interface="org.bluez.HandsfreeAgent"/>
-    <allow send_interface="org.bluez.MediaEndpoint"/>
-    <allow send_interface="org.bluez.MediaPlayer"/>
+    <allow send_interface="org.bluez.MediaEndpoint1"/>
+    <allow send_interface="org.bluez.MediaPlayer1"/>
     <allow send_interface="org.bluez.Watcher"/>
     <allow send_interface="org.bluez.ThermometerWatcher"/>
     <allow send_interface="org.bluez.AlertAgent"/>
diff --git a/test/simple-endpoint b/test/simple-endpoint
index b363943..590f83a 100755
--- a/test/simple-endpoint
+++ b/test/simple-endpoint
@@ -55,25 +55,25 @@ class Endpoint(dbus.service.Object):
 	def default_configuration(self, configuration):
 		self.configuration = configuration
 
-	@dbus.service.method("org.bluez.MediaEndpoint",
+	@dbus.service.method("org.bluez.MediaEndpoint1",
 					in_signature="", out_signature="")
 	def Release(self):
 		print("Release")
 		if self.exit_on_release:
 			mainloop.quit()
 
-	@dbus.service.method("org.bluez.MediaEndpoint",
+	@dbus.service.method("org.bluez.MediaEndpoint1",
 					in_signature="", out_signature="")
 	def ClearConfiguration(self):
 		print("ClearConfiguration")
 
-	@dbus.service.method("org.bluez.MediaEndpoint",
+	@dbus.service.method("org.bluez.MediaEndpoint1",
 					in_signature="oay", out_signature="")
 	def SetConfiguration(self, transport, config):
 		print("SetConfiguration (%s, %s)" % (transport, config))
 		return
 
-	@dbus.service.method("org.bluez.MediaEndpoint",
+	@dbus.service.method("org.bluez.MediaEndpoint1",
 					in_signature="ay", out_signature="ay")
 	def SelectConfiguration(self, caps):
 		print("SelectConfiguration (%s)" % (caps))
@@ -90,7 +90,7 @@ if __name__ == '__main__':
 		path = bluezutils.find_adapter().object_path
 
 	media = dbus.Interface(bus.get_object("org.bluez", path),
-						"org.bluez.Media")
+						"org.bluez.Media1")
 
 	path = "/test/endpoint"
 	endpoint = Endpoint(bus, path)
diff --git a/test/simple-player b/test/simple-player
index 7eb7d7e..3bfc485 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -17,11 +17,11 @@ class Player(dbus.service.Object):
 		if obj != None:
 			bus = dbus.SystemBus()
 			mp = dbus.Interface(bus.get_object("org.bluez", obj),
-						"org.bluez.MediaPlayer")
+						"org.bluez.MediaPlayer1")
 			prop = dbus.Interface(bus.get_object("org.bluez", obj),
 						"org.freedesktop.DBus.Properties")
 
-			self.properties = prop.GetAll("org.bluez.MediaPlayer")
+			self.properties = prop.GetAll("org.bluez.MediaPlayer1")
 			self.metadata = mp.GetTrack()
 
 			bus.add_signal_receiver(self.properties_changed,
@@ -56,7 +56,7 @@ class Player(dbus.service.Object):
 			gobject.io_add_watch(sys.stdin, gobject.IO_IN,
 							handler.handle)
 
-	@dbus.service.method("org.bluez.MediaPlayer",
+	@dbus.service.method("org.bluez.MediaPlayer1",
 					in_signature="", out_signature="")
 	def Release(self):
 		print("Release")
@@ -79,7 +79,7 @@ class Player(dbus.service.Object):
 		"""
 		pass
 
-	@dbus.service.signal("org.bluez.MediaPlayer", signature="a{sv}")
+	@dbus.service.signal("org.bluez.MediaPlayer1", signature="a{sv}")
 	def TrackChanged(self, metadata):
 		"""TrackChanged(metadata)
 
@@ -149,7 +149,7 @@ if __name__ == '__main__':
 		path = bluezutils.find_adapter().object_path
 
 	media = dbus.Interface(bus.get_object("org.bluez", path),
-						"org.bluez.Media")
+						"org.bluez.Media1")
 
 	path = "/test/player"
 	player = Player(bus, path)
-- 
1.8.0.1


^ permalink raw reply related

* 3.6.8: BT USB with rfcomm/pppd crash on dongle pull
From: Michael Büsch @ 2012-12-05 20:45 UTC (permalink / raw)
  To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg; +Cc: linux-bluetooth

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

The following crash happened by pulling a BT USB dongle while
an rfcomm/pppd connection was active over that dongle.

The dongle was connected to a 4-port USB hub. A usb-serial-dongle
was also connected to that hub.
The _hub_ was pulled from the host USB port. (The BT USB dongle remained in the hub).


[427194.250218] usb 1-2: USB disconnect, device number 82
[427194.250243] usb 1-2.1: USB disconnect, device number 89
[427194.250688] cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0
[427194.250771] cp210x 1-2.1:1.0: device disconnected
[427194.251377] usb 1-2.4: USB disconnect, device number 83
[427194.251845] general protection fault: 0000 [#1] PREEMPT SMP 
[427194.252114] Modules linked in: uvcvideo nfnetlink_log nfnetlink bridge stp llc cp210x nls_utf8 nls_cp437 acpi_cpufreq mperf ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6t_rt ipt_MASQUERADE xt_conntrack ipt_REJECT xt_tcpudp ip6table_mangle ip6table_filter ip6_tables iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_conntrack iptable_mangle iptable_filter ip_tables x_tables videobuf2_vmalloc videobuf2_memops videobuf2_core i915 drm_kms_helper video kvm_intel kvm [last unloaded: uvcvideo]
[427194.254255] CPU 0 
[427194.254326] Pid: 30, comm: khubd Not tainted 3.6.8+ #3 ASUSTeK Computer INC. 1011PX/1015PE
[427194.254557] RIP: 0010:[<ffffffff8182e752>]  [<ffffffff8182e752>] l2cap_chan_destroy+0x32/0x80
[427194.254811] RSP: 0018:ffff88007c545b90  EFLAGS: 00010246
[427194.254959] RAX: dead000000200200 RBX: ffff8800263dd800 RCX: 0000000000000000
[427194.255051] RDX: dead000000100100 RSI: dead000000100100 RDI: dead000000200200
[427194.255051] RBP: ffff8800263a8900 R08: ffff88007c544000 R09: 0000000000000000
[427194.255051] R10: 000000000000294c R11: 0000000000000000 R12: 0000000000000067
[427194.255051] R13: ffff8800263a8800 R14: ffff8800263ddad0 R15: ffff8800263a8660
[427194.255051] FS:  0000000000000000(0000) GS:ffff88007f400000(0000) knlGS:0000000000000000
[427194.255051] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[427194.255051] CR2: ffffffffff600400 CR3: 0000000001e0c000 CR4: 00000000000007e0
[427194.255051] DR0: 0000000000000001 DR1: 0000000000000002 DR2: 0000000000000001
[427194.255051] DR3: 000000000000000a DR6: 00000000ffff0ff0 DR7: 0000000000000400
[427194.255051] Process khubd (pid: 30, threadinfo ffff88007c544000, task ffff880000153b10)
[427194.255051] Stack:
[427194.255051]  ffff8800263df800 ffffffff81833530 ffff8800263dd800 ffffffff8182ebba
[427194.255051]  ffff8800263dd000 ffff8800263a8910 ffff8800024de578 ffff8800263dd000
[427194.255051]  ffff8800024de610 ffff8800024de610 ffff880005f12800 0000000000000000
[427194.255051] Call Trace:
[427194.255051]  [<ffffffff81833530>] ? l2cap_sock_kill+0x30/0x50
[427194.255051]  [<ffffffff8182ebba>] ? l2cap_conn_del+0xaa/0x170
[427194.255051]  [<ffffffff818329a7>] ? l2cap_disconn_cfm+0x17/0x20
[427194.255051]  [<ffffffff8181a68d>] ? hci_conn_hash_flush+0x9d/0xb0
[427194.255051]  [<ffffffff818164a4>] ? hci_dev_do_close+0xc4/0x3a0
[427194.255051]  [<ffffffff8181853f>] ? hci_unregister_dev+0x5f/0x170
[427194.255051]  [<ffffffff8163e715>] ? btusb_disconnect+0x55/0xd0
[427194.255051]  [<ffffffff8156abfa>] ? usb_unbind_interface+0x6a/0x1c0
[427194.255051]  [<ffffffff81462f37>] ? __device_release_driver+0x77/0xf0
[427194.255051]  [<ffffffff814631a9>] ? device_release_driver+0x29/0x40
[427194.255051]  [<ffffffff814629f3>] ? bus_remove_device+0xc3/0x100
[427194.255051]  [<ffffffff814602bb>] ? device_del+0x11b/0x1a0
[427194.255051]  [<ffffffff815688b4>] ? usb_disable_device+0x94/0x1e0
[427194.255051]  [<ffffffff81560bbf>] ? usb_disconnect+0x7f/0x110
[427194.255051]  [<ffffffff81560ba9>] ? usb_disconnect+0x69/0x110
[427194.255051]  [<ffffffff81562710>] ? hub_thread+0x420/0x1320
[427194.255051]  [<ffffffff819260d3>] ? __schedule+0x2a3/0x670
[427194.255051]  [<ffffffff810887f0>] ? finish_wait+0xa0/0xa0
[427194.255051]  [<ffffffff815622f0>] ? usb_remote_wakeup+0x40/0x40
[427194.255051]  [<ffffffff81087f77>] ? kthread+0x87/0x90
[427194.255051]  [<ffffffff81929074>] ? kernel_thread_helper+0x4/0x10
[427194.255051]  [<ffffffff81087ef0>] ? kthread_freezable_should_stop+0x50/0x50
[427194.255051]  [<ffffffff81929070>] ? gs_change+0xb/0xb
[427194.255051] Code: 80 cc ea 81 e8 20 8a 0f 00 48 be 00 01 10 00 00 00 ad de 48 bf 00 02 20 00 00 00 ad de 48 8b 83 b8 02 00 00 48 8b 93 b0 02 00 00 <48> 89 42 08 48 89 10 48 89 bb b8 02 00 00 48 89 b3 b0 02 00 00 
[427194.255051] RIP  [<ffffffff8182e752>] l2cap_chan_destroy+0x32/0x80
[427194.255051]  RSP <ffff88007c545b90>
[427194.349290] ---[ end trace 286151bbf87935e3 ]---
[427194.349306] note: khubd[30] exited with preempt_count 1


-- 
Greetings, Michael.

PGP encryption is encouraged / 908D8B0E

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [PATCH v1 0/6] Remove access rights from MediaTransport
From: Johan Hedberg @ 2012-12-05 17:25 UTC (permalink / raw)
  To: Mikel Astiz; +Cc: linux-bluetooth, Mikel Astiz
In-Reply-To: <1354724134-7354-1-git-send-email-mikel.astiz.oss@gmail.com>

Hi Mikel,

On Wed, Dec 05, 2012, Mikel Astiz wrote:
> v1 proposes TryAcquire() instead of Acquire(TRUE), as suggested by
> Johan.
> 
> From original cover-letter:
> 
> The accessrights used in the Acquire() method are not very useful and
> can thus be removed. This simplifies both the D-Bus API and the
> internal implementation significantly.
> 
> Mikel Astiz (6):
>   media: Remove transport access type from D-Bus API
>   media: Remove internal transport locks
>   media: Remove transport owner list
>   media: Add MediaTransport.TryAcquire()
>   media: Trivial style fix
>   media: Add version suffix to all media interfaces
> 
>  doc/audio-telephony-design.txt |   4 +-
>  doc/media-api.txt              |  46 +++----
>  profiles/audio/media.c         |   8 +-
>  profiles/audio/player.c        |   2 +-
>  profiles/audio/transport.c     | 264 ++++++++++++-----------------------------
>  test/mpris-player.c            |  14 +--
>  6 files changed, 108 insertions(+), 230 deletions(-)

All patches in this set have been applied. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH BlueZ v2] l2test: Add support to test auto select PSM
From: Johan Hedberg @ 2012-12-05 17:22 UTC (permalink / raw)
  To: Syam Sidhardhan; +Cc: linux-bluetooth
In-Reply-To: <1354724501-5368-1-git-send-email-s.syam@samsung.com>

Hi Syam,

On Wed, Dec 05, 2012, Syam Sidhardhan wrote:
> This patch enable us to test the auto select PSM by passing
> PSM value as 0.
> 
> Ex: l2test -d -P 0
> l2test[2585]: Waiting for connection on psm 4099 ...
> ---
> v2 -> Retain the interoperability issue mentioned by Gustavo.

Applied. Thanks.

Johan

^ permalink raw reply

* [PATCH BlueZ v2] l2test: Add support to test auto select PSM
From: Syam Sidhardhan @ 2012-12-05 16:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Syam Sidhardhan

This patch enable us to test the auto select PSM by passing
PSM value as 0.

Ex: l2test -d -P 0
l2test[2585]: Waiting for connection on psm 4099 ...
---
v2 -> Retain the interoperability issue mentioned by Gustavo.
 
 test/l2test.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/test/l2test.c b/test/l2test.c
index 7f9f007..c88116d 100644
--- a/test/l2test.c
+++ b/test/l2test.c
@@ -454,8 +454,6 @@ static void do_listen(void (*handler)(int sk))
 		addr.l2_cid = htobs(cid);
 	else if (psm)
 		addr.l2_psm = htobs(psm);
-	else
-		goto error;
 
 	if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
 		syslog(LOG_ERR, "Can't bind socket: %s (%d)",
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v1 6/6] media: Add version suffix to all media interfaces
From: Mikel Astiz @ 2012-12-05 16:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1354724134-7354-1-git-send-email-mikel.astiz.oss@gmail.com>

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

Append the version number to all D-Bus interface names in the Media API.
---
 doc/audio-telephony-design.txt |  4 ++--
 doc/media-api.txt              | 20 ++++++++++----------
 profiles/audio/media.c         |  8 ++++----
 profiles/audio/player.c        |  2 +-
 profiles/audio/transport.c     |  2 +-
 test/mpris-player.c            | 14 +++++++-------
 6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/doc/audio-telephony-design.txt b/doc/audio-telephony-design.txt
index ec575f2..308986b 100644
--- a/doc/audio-telephony-design.txt
+++ b/doc/audio-telephony-design.txt
@@ -35,9 +35,9 @@ When a new device is connected, NewConnection method of Profile1 agent
 is called with informations related to connecting profile (like RFCOMM
 client file descriptor, version, features, media end point path, ...).
 
-The telephony application is in charge to implement a MediaTransport for
+The telephony application is in charge to implement a MediaTransport1 for
 its audio connection with remote device and interact with the
-MediaTransport of the audio component (i.e. PulseAudio).
+MediaTransport1 of the audio component (i.e. PulseAudio).
 
 Flow charts
 ===========
diff --git a/doc/media-api.txt b/doc/media-api.txt
index 5e052b4..ce7502a 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -5,7 +5,7 @@ Media hierarchy
 ===============
 
 Service		org.bluez
-Interface	org.bluez.Media
+Interface	org.bluez.Media1
 Object path	[variable prefix]/{hci0,hci1,...}
 
 Methods		void RegisterEndpoint(object endpoint, dict properties)
@@ -123,12 +123,12 @@ Methods		void RegisterEndpoint(object endpoint, dict properties)
 
 			Unregister sender media player.
 
-MediaPlayer hierarchy
-=====================
+MediaPlayer1 hierarchy
+======================
 
 Service		unique name (Target role)
 		org.bluez (Controller role)
-Interface	org.bluez.MediaPlayer
+Interface	org.bluez.Media1Player1
 Object path	freely definable (Target role)
 		[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
 		(Controller role)
@@ -219,11 +219,11 @@ Properties	string Equalizer [readwrite]
 			possible to signal its end by setting position to the
 			maximum uint32 value.
 
-MediaEndpoint hierarchy
-=======================
+MediaEndpoint1 hierarchy
+========================
 
 Service		unique name
-Interface	org.bluez.MediaEndpoint
+Interface	org.bluez.Media1Endpoint1
 Object path	freely definable
 
 Methods		void SetConfiguration(object transport, dict properties)
@@ -254,11 +254,11 @@ Methods		void SetConfiguration(object transport, dict properties)
 			endpoint, because when this method gets called it has
 			already been unregistered.
 
-MediaTransport hierarchy
-========================
+MediaTransport1 hierarchy
+=========================
 
 Service		org.bluez
-Interface	org.bluez.MediaTransport
+Interface	org.bluez.MediaTransport1
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/fdX
 
 Methods		fd, uint16, uint16 Acquire()
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 2041d23..7c0bc0a 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -50,9 +50,9 @@
 #include "avrcp.h"
 #include "manager.h"
 
-#define MEDIA_INTERFACE "org.bluez.Media"
-#define MEDIA_ENDPOINT_INTERFACE "org.bluez.MediaEndpoint"
-#define MEDIA_PLAYER_INTERFACE "org.bluez.MediaPlayer"
+#define MEDIA_INTERFACE "org.bluez.Media1"
+#define MEDIA_ENDPOINT_INTERFACE "org.bluez.Media1Endpoint1"
+#define MEDIA_PLAYER_INTERFACE "org.bluez.MediaPlayer1"
 
 #define REQUEST_TIMEOUT (3 * 1000)		/* 3 seconds */
 
@@ -402,7 +402,7 @@ static gboolean set_configuration(struct media_endpoint *endpoint,
 	path = media_transport_get_path(transport);
 	dbus_message_iter_append_basic(&iter, DBUS_TYPE_OBJECT_PATH, &path);
 
-	g_dbus_get_properties(conn, path, "org.bluez.MediaTransport", &iter);
+	g_dbus_get_properties(conn, path, "org.bluez.MediaTransport1", &iter);
 
 	return media_endpoint_async_call(msg, endpoint, cb, user_data, destroy);
 }
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 34b1f20..368bfa8 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -42,7 +42,7 @@
 #include "dbus-common.h"
 #include "error.h"
 
-#define MEDIA_PLAYER_INTERFACE "org.bluez.MediaPlayer"
+#define MEDIA_PLAYER_INTERFACE "org.bluez.MediaPlayer1"
 
 struct player_callback {
 	const struct media_player_callback *cbs;
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 666f68a..165ebd3 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -48,7 +48,7 @@
 #include "source.h"
 #include "avrcp.h"
 
-#define MEDIA_TRANSPORT_INTERFACE "org.bluez.MediaTransport"
+#define MEDIA_TRANSPORT_INTERFACE "org.bluez.MediaTransport1"
 
 typedef enum {
 	TRANSPORT_STATE_IDLE,		/* Not acquired and suspended */
diff --git a/test/mpris-player.c b/test/mpris-player.c
index 7985cdd..90c87aa 100644
--- a/test/mpris-player.c
+++ b/test/mpris-player.c
@@ -186,7 +186,7 @@ static int parse_property(DBusConnection *conn, const char *path,
 						DBUS_TYPE_STRING, &value);
 		else
 			emit_properties_changed(sys, path,
-					"org.bluez.MediaPlayer", "Status",
+					"org.bluez.MediaPlayer1", "Status",
 					DBUS_TYPE_STRING, &value);
 	} else if (strcasecmp(key, "Position") == 0) {
 		int64_t usec, msec;
@@ -203,7 +203,7 @@ static int parse_property(DBusConnection *conn, const char *path,
 						DBUS_TYPE_UINT32, &msec);
 		else
 			emit_properties_changed(sys, path,
-					"org.bluez.MediaPlayer", "Position",
+					"org.bluez.MediaPlayer1", "Position",
 					DBUS_TYPE_UINT32, &msec);
 	} else if (strcasecmp(key, "Shuffle") == 0) {
 		dbus_bool_t value;
@@ -221,7 +221,7 @@ static int parse_property(DBusConnection *conn, const char *path,
 						DBUS_TYPE_STRING, &str);
 		else
 			emit_properties_changed(sys, path,
-					"org.bluez.MediaPlayer", "Shuffle",
+					"org.bluez.MediaPlayer1", "Shuffle",
 					DBUS_TYPE_STRING, &str);
 	}
 
@@ -446,7 +446,7 @@ static char *sender2path(const char *sender)
 static DBusHandlerResult player_message(DBusConnection *conn,
 						DBusMessage *msg, void *data)
 {
-	if (dbus_message_is_method_call(msg, "org.bluez.MediaPlayer",
+	if (dbus_message_is_method_call(msg, "org.bluez.MediaPlayer1",
 								"Release")) {
 		printf("Release\n");
 		exit(1);
@@ -472,7 +472,7 @@ static void add_player(DBusConnection *conn, const char *name,
 		return;
 
 	msg = dbus_message_new_method_call("org.bluez", adapter,
-					"org.bluez.Media",
+					"org.bluez.Media1",
 					"RegisterPlayer");
 	if (!msg) {
 		fprintf(stderr, "Can't allocate new method call\n");
@@ -539,7 +539,7 @@ static void remove_player(DBusConnection *conn, const char *sender)
 	char *path;
 
 	msg = dbus_message_new_method_call("org.bluez", adapter,
-					"org.bluez.Media",
+					"org.bluez.Media1",
 					"UnregisterPlayer");
 	if (!msg) {
 		fprintf(stderr, "Can't allocate new method call\n");
@@ -578,7 +578,7 @@ static DBusHandlerResult properties_changed(DBusConnection *conn,
 	path = sender2path(dbus_message_get_sender(msg));
 	parse_properties(conn, path, &iter, NULL);
 
-	signal = dbus_message_new_signal(path, "org.bluez.MediaPlayer",
+	signal = dbus_message_new_signal(path, "org.bluez.MediaPlayer1",
 							"TrackChanged");
 	if (!signal) {
 		fprintf(stderr, "Unable to allocate new PropertyChanged"
-- 
1.7.11.7


^ permalink raw reply related

* [PATCH v1 5/6] media: Trivial style fix
From: Mikel Astiz @ 2012-12-05 16:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1354724134-7354-1-git-send-email-mikel.astiz.oss@gmail.com>

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

No whitespace should exist before parenthesis close.
---
 profiles/audio/transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 0fd2469..666f68a 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -663,7 +663,7 @@ static const GDBusMethodTable transport_methods[] = {
 	{ GDBUS_ASYNC_METHOD("Acquire",
 			NULL,
 			GDBUS_ARGS({ "fd", "h" }, { "mtu_r", "q" },
-							{ "mtu_w", "q" } ),
+							{ "mtu_w", "q" }),
 			acquire) },
 	{ GDBUS_ASYNC_METHOD("TryAcquire",
 			NULL,
-- 
1.7.11.7


^ permalink raw reply related

* [PATCH v1 4/6] media: Add MediaTransport.TryAcquire()
From: Mikel Astiz @ 2012-12-05 16:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz
In-Reply-To: <1354724134-7354-1-git-send-email-mikel.astiz.oss@gmail.com>

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

Split the Acquire() method in two parts so that the optional acquires,
formerly represented as a "?" flag in the accesstype parameter of
Acquire(), are now implemented in TryAcquire().
---
 doc/media-api.txt          |  7 +++++++
 profiles/audio/transport.c | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/doc/media-api.txt b/doc/media-api.txt
index b15ad61..5e052b4 100644
--- a/doc/media-api.txt
+++ b/doc/media-api.txt
@@ -266,6 +266,13 @@ Methods		fd, uint16, uint16 Acquire()
 			Acquire transport file descriptor and the MTU for read
 			and write respectively.
 
+		fd, uint16, uint16 TryAcquire()
+
+			Acquire transport file descriptor only if the transport
+			is in "pending" state at the time the message is
+			received by BlueZ. Otherwise no request will be sent
+			to the remote device and the function will just fail.
+
 		void Release()
 
 			Releases file descriptor.
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 1064098..0fd2469 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -463,6 +463,37 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
 	return NULL;
 }
 
+static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
+								void *data)
+{
+	struct media_transport *transport = data;
+	struct media_owner *owner;
+	struct media_request *req;
+	guint id;
+
+	if (transport->owner != NULL)
+		return btd_error_not_authorized(msg);
+
+	if (transport->state >= TRANSPORT_STATE_REQUESTING)
+		return btd_error_not_authorized(msg);
+
+	if (transport->state != TRANSPORT_STATE_PENDING)
+		return btd_error_failed(msg, "Transport not playing");
+
+	owner = media_owner_create(msg);
+	id = transport->resume(transport, owner);
+	if (id == 0) {
+		media_owner_free(owner);
+		return btd_error_not_authorized(msg);
+	}
+
+	req = media_request_create(msg, id);
+	media_owner_add(owner, req);
+	media_transport_set_owner(transport, owner);
+
+	return NULL;
+}
+
 static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
 					void *data)
 {
@@ -634,6 +665,11 @@ static const GDBusMethodTable transport_methods[] = {
 			GDBUS_ARGS({ "fd", "h" }, { "mtu_r", "q" },
 							{ "mtu_w", "q" } ),
 			acquire) },
+	{ GDBUS_ASYNC_METHOD("TryAcquire",
+			NULL,
+			GDBUS_ARGS({ "fd", "h" }, { "mtu_r", "q" },
+							{ "mtu_w", "q" }),
+			try_acquire) },
 	{ GDBUS_ASYNC_METHOD("Release", NULL, NULL, release) },
 	{ },
 };
-- 
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