Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] android/pics: Add PICS and PIXIT for HSP
From: Sebastian Chlad @ 2014-02-24 11:54 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sebastian Chlad

Added PICS and PIXIT target Android 4.4
---
 android/Makefile.am   |   2 +
 android/pics-hsp.txt  | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
 android/pixit-hsp.txt |  30 +++++++++++++++
 3 files changed, 135 insertions(+)
 create mode 100644 android/pics-hsp.txt
 create mode 100644 android/pixit-hsp.txt

diff --git a/android/Makefile.am b/android/Makefile.am
index 50d0dc0..58cfbae 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -188,6 +188,7 @@ EXTRA_DIST += android/Android.mk android/README \
 				android/pics-a2dp.txt \
 				android/pics-avctp.txt \
 				android/pics-avrcp.txt \
+				android/pics-hsp.txt \
 				android/pixit-l2cap.txt \
 				android/pixit-gap.txt \
 				android/pixit-did.txt \
@@ -199,6 +200,7 @@ EXTRA_DIST += android/Android.mk android/README \
 				android/pixit-a2dp.txt \
 				android/pixit-avctp.txt \
 				android/pixit-avrcp.txt \
+				android/pixit-hsp.txt \
 				android/pts-l2cap.txt \
 				android/pts-gap.txt \
 				android/pts-did.txt \
diff --git a/android/pics-hsp.txt b/android/pics-hsp.txt
new file mode 100644
index 0000000..015b619
--- /dev/null
+++ b/android/pics-hsp.txt
@@ -0,0 +1,103 @@
+HSP PICS for the PTS tool.
+
+PTS version: 5.0
+
+* - different than PTS defaults
+# - not yet implemented/supported
+
+M - mandatory
+O - optional
+
+		Version
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_HSP_0_1	False		Version: Headset Profile v1.1 (C.1)
+TSPC_HSP_0_2	True		Version: Headset Profile v1.2 (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory to support one and only one of these versions.
+-------------------------------------------------------------------------------
+
+
+		Roles
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_HSP_1_1	True		Role: Audio Gateway (AG) (C.1)
+TSPC_HSP_1_2	False		Role: Headset (HS) (C.1)
+-------------------------------------------------------------------------------
+C.1: Mandatory to support at least one of the defined roles.
+-------------------------------------------------------------------------------
+
+
+		Audio Gateway Role
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_HSP_2_1	True		Incoming audio connection establishment (M)
+TSPC_HSP_2_2	True		Ring (AT command) (C.3)
+TSPC_HSP_2_3	False		Inband ring tone (O)
+TSPC_HSP_2_4	True		Outgoing audio connection establishment (O)
+TSPC_HSP_2_5	True		Audio connection release from HS (C.5)
+TSPC_HSP_2_6	True		Audio connection release from AG (M)
+TSPC_HSP_2_7	True		Audio connection transfer: AG to HS (M)
+TSPC_HSP_2_8	True		Audio connection transfer: HS to AG (M)
+TSPC_HSP_2_9	False		Remote audio volume control (C.1)
+TSPC_HSP_2_10	False		HS informs AG about local changes of audio
+					volume (O)
+TSPC_HSP_2_11	False		Audio volume setting storage by HS (O)
+TSPC_HSP_2_12	False		Remote microphone gain control (C.2)
+TSPC_HSP_2_13	False		HS informs AG about local changes of microphone
+					gain (O)
+TSPC_HSP_2_14	False		Microphone gain setting storage by HS (O)
+TSPC_HSP_2_15	True		Connection handling with Detach/Page (M)
+TSPC_HSP_2_16	False		Connection handling with Park Mode (C.4)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_HSP_2_10 is supported, otherwise optional
+C:2: Mandatory if TSPC_HSP_2_13 is supported, otherwise optional
+C.3: Excluded if TSPC_HSP_2_3 and TSPC_HSP_4_1 ("Show that in-band
+	ringing and RING are mutually exclusive") are supported,
+	otherwise optional
+C.4: Excluded if TSPC_HSP_0_2 is supported, otherwise optional
+C.5: Mandatory if TSPC_HSP_0_1 is supported, otherwise optional
+-------------------------------------------------------------------------------
+
+
+		Headset Application Features
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_HSP_3_1	False		Incoming audio connection establishment (M)
+TSPC_HSP_3_2	False		Ring (AT command) (M)
+TSPC_HSP_3_3	False		Inband ring tone (M)
+TSPC_HSP_3_4	False		Outgoing audio connection establishment (M)
+TSPC_HSP_3_5	False		Audio connection release from HS (M)
+TSPC_HSP_3_6	False		Audio connection release from AG (M)
+TSPC_HSP_3_7	False		Audio connection transfer: AG to HS (M)
+TSPC_HSP_3_8	False		Audio connection transfer: HS to AG (M)
+TSPC_HSP_3_9	False		Remote audio volume control (C.1)
+TSPC_HSP_3_10	False		HS informs AG about local changes of audio
+                                        volume (O)
+TSPC_HSP_3_11	False		Audio volume setting storage by HS (O)
+TSPC_HSP_3_12	False		Remote microphone gain control (C.2)
+TSPC_HSP_3_13	False		HS informs AG about local changes of microphone
+                                        gain (O)
+TSPC_HSP_3_14	False		Microphone gain setting storage by HS (O)
+TSPC_HSP_3_15	False		Connection handling with Detach/Page (M)
+TSPC_HSP_3_16	False		Connection handling with Park Mode (C.3)
+-------------------------------------------------------------------------------
+C.1: Mandatory if TSPC_HSP_3_10 is supported, otherwise optional
+C.2: Mandatory if TSPC_HSP_2_13 is supported, otherwise optional
+C.3: Excluded if TSPC_HSP_0_2 is supported, otherwise optional
+-------------------------------------------------------------------------------
+
+
+		Errata Service Releases
+-------------------------------------------------------------------------------
+Parameter Name	Selected	Description
+-------------------------------------------------------------------------------
+TSPC_HSP_4_1	False		Show that in-band ringing and RING are
+					mutually exclusive (C.1)
+-------------------------------------------------------------------------------
+C.1: Excluded if TSPC_HSP_0_2 is supported, otherwise optional
+-------------------------------------------------------------------------------
diff --git a/android/pixit-hsp.txt b/android/pixit-hsp.txt
new file mode 100644
index 0000000..2bda4fa
--- /dev/null
+++ b/android/pixit-hsp.txt
@@ -0,0 +1,30 @@
+HSP PIXIT for the PTS tool.
+
+PTS version: 5.0
+
+* - different than PTS defaults
+& - should be set to IUT Bluetooth address
+
+		Required PIXIT settings
+-------------------------------------------------------------------------------
+Parameter Name						Value
+-------------------------------------------------------------------------------
+TSPX_security_enabled					TRUE
+TSPX_bd_addr_iut					08606E414394 (&)
+TSPX_hs_class_of_device					200404
+TSPX_ag_class_of_device					400204
+TSPX_packet_type_sco					00A0
+TSPX_pin_code						0000
+TSPX_time_guard						20000000
+TSPX_use_implicit_send					TRUE
+TSPX_verbose_implicit_send				FALSE
+TSPX_delete_link_key					FALSE
+TSPX_server_channel_tester				01
+TSPX_server_channel_iut					00
+TSPX_no_fail_verdict					FALSE
+TSPX_remote_audio_volume_control			TRUE
+TSPX_secure_simple_pairing_pass_key_confirmation	FALSE
+TSPX_inband_ring_only					FALSE
+TSPX_no_ring_or_inband_ring_tone			FALSE
+TSPX_iut_establish_audio_before_RING			FALSE
+-------------------------------------------------------------------------------
-- 
1.8.5.3


^ permalink raw reply related

* Re: [PATCHv2 4/6] android/avrcp: Use NULL for zero pointers
From: Luiz Augusto von Dentz @ 2014-02-24 12:31 UTC (permalink / raw)
  To: Andrei Emeltchenko, linux-bluetooth@vger.kernel.org
In-Reply-To: <20140224065517.GB4133@aemeltch-MOBL1>

Hi Andrei,

On Mon, Feb 24, 2014 at 8:55 AM, Andrei Emeltchenko
<andrei.emeltchenko@gmail.com> wrote:
> On Fri, Feb 21, 2014 at 05:23:48PM +0200, Andrei Emeltchenko wrote:
>> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> ping
>
>>
>> ---
>>  android/avrcp.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/android/avrcp.c b/android/avrcp.c
>> index 8ac9e2f..acffd56 100644
>> --- a/android/avrcp.c
>> +++ b/android/avrcp.c
>> @@ -222,7 +222,7 @@ static sdp_record_t *avrcp_record(void)
>>       features = sdp_data_alloc(SDP_UINT16, &feat);
>>       sdp_attr_add(record, SDP_ATTR_SUPPORTED_FEATURES, features);
>>
>> -     sdp_set_info_attr(record, "AVRCP TG", 0, 0);
>> +     sdp_set_info_attr(record, "AVRCP TG", NULL, NULL);
>>
>>       sdp_data_free(psm);
>>       sdp_data_free(version);
>> --
>> 1.8.3.2

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH 1/2] unit/avrcp: Add /TP/ICC/BV-01-I test
From: Luiz Augusto von Dentz @ 2014-02-24 12:31 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1393235125-28822-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Mon, Feb 24, 2014 at 11:45 AM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Test verifies that the Target responds to UNIT INFO command initiated by
> Controller.
> ---
>  unit/test-avrcp.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
> index f1c0f46..edbcad1 100644
> --- a/unit/test-avrcp.c
> +++ b/unit/test-avrcp.c
> @@ -242,6 +242,30 @@ static void test_dummy(gconstpointer data)
>         destroy_context(context);
>  }
>
> +static void execute_context(struct context *context)
> +{
> +       g_main_loop_run(context->main_loop);
> +
> +       if (context->source > 0)
> +               g_source_remove(context->source);
> +
> +       avrcp_shutdown(context->session);
> +
> +       g_main_loop_unref(context->main_loop);
> +
> +       test_free(context->data);
> +       g_free(context);
> +}
> +
> +static void test_server(gconstpointer data)
> +{
> +       struct context *context = create_context(0x0100, data);
> +
> +       g_idle_add(send_pdu, context);
> +
> +       execute_context(context);
> +}
> +
>  int main(int argc, char *argv[])
>  {
>         g_test_init(&argc, &argv, NULL);
> @@ -261,5 +285,13 @@ int main(int argc, char *argv[])
>         define_test("/TP/CRC/BV-01-I", test_dummy, raw_pdu(0x00));
>         define_test("/TP/CRC/BV-02-I", test_dummy, raw_pdu(0x00));
>
> +       /* Information collection for control tests */
> +
> +       define_test("/TP/ICC/BV-01-I", test_server,
> +                       raw_pdu(0x00, 0x11, 0x0e, 0x01, 0xf8, 0x30,
> +                               0xff, 0xff, 0xff, 0xff, 0xff),
> +                       raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0xf8, 0x30,
> +                               0x07, 0x48, 0xff, 0xff, 0xff));
> +
>         return g_test_run();
>  }
> --
> 1.8.3.2

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* Re: [PATCH BlueZ 1/3] android/avrcp-lib: Rename AVCTP session to conn
From: Luiz Augusto von Dentz @ 2014-02-24 12:38 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1392907255-29758-1-git-send-email-luiz.dentz@gmail.com>

Hi,

On Thu, Feb 20, 2014 at 4:40 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
>  android/avrcp-lib.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
> index ef48fa7..8450480 100644
> --- a/android/avrcp-lib.c
> +++ b/android/avrcp-lib.c
> @@ -36,13 +36,13 @@
>  #include "avrcp-lib.h"
>
>  struct avrcp {
> -       struct avctp    *session;
> +       struct avctp    *conn;
>  };
>
>  void avrcp_shutdown(struct avrcp *session)
>  {
> -       if (session->session)
> -               avctp_shutdown(session->session);
> +       if (session->conn)
> +               avctp_shutdown(session->conn);
>
>         g_free(session);
>  }
> @@ -53,8 +53,8 @@ struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
>
>         session = g_new0(struct avrcp, 1);
>
> -       session->session = avctp_new(fd, imtu, omtu, version);
> -       if (!session->session) {
> +       session->conn = avctp_new(fd, imtu, omtu, version);
> +       if (!session->conn) {
>                 g_free(session);
>                 return NULL;
>         }
> @@ -65,11 +65,11 @@ struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
>  void avrcp_set_destroy_cb(struct avrcp *session, avrcp_destroy_cb_t cb,
>                                                         void *user_data)
>  {
> -       avctp_set_destroy_cb(session->session, cb, user_data);
> +       avctp_set_destroy_cb(session->conn, cb, user_data);
>  }
>
>  int avrcp_init_uinput(struct avrcp *session, const char *name,
>                                                         const char *address)
>  {
> -       return avctp_init_uinput(session->session, name, address);
> +       return avctp_init_uinput(session->conn, name, address);
>  }
> --
> 1.8.5.3

Pushed.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH 1/2] android: Change define name for valgrind prop
From: Lukasz Rymanowski @ 2014-02-24 12:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Rymanowski

---
 android/bluetoothd-wrapper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c
index 122e6b0..3a9f32e 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
@@ -22,7 +22,7 @@
 
 #include <cutils/properties.h>
 
-#define PROPERTY_NAME "persist.sys.bluetooth.valgrind"
+#define PROPERTY_VALGRIND_NAME "persist.sys.bluetooth.valgrind"
 
 #define VALGRIND_BIN "/system/bin/valgrind"
 
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
 {
 	char value[PROPERTY_VALUE_MAX];
 
-	if (property_get(PROPERTY_NAME, value, "") > 0 &&
+	if (property_get(PROPERTY_VALGRIND_NAME, value, "") > 0 &&
 			(!strcasecmp(value, "true") || atoi(value) > 0))
 		run_valgrind();
 
-- 
1.8.4


^ permalink raw reply related

* [PATCH 2/2] android: Add possible to enable mgmt debug logs
From: Lukasz Rymanowski @ 2014-02-24 12:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1393245551-8145-1-git-send-email-lukasz.rymanowski@tieto.com>

With this patch it is possible to enable mgmt inteface logs which might
be useful when debuging. In order to enable it is required to set
property persist.sys.bluetooth.mgmtdbg to 1 or literaly "true".
More info in README
---
 android/README               | 10 ++++++++++
 android/bluetooth.c          | 11 ++++++++++-
 android/bluetooth.h          |  2 +-
 android/bluetoothd-wrapper.c | 19 +++++++++++++++----
 android/main.c               |  6 +++++-
 5 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/android/README b/android/README
index 3095383..11d5ddd 100644
--- a/android/README
+++ b/android/README
@@ -130,6 +130,16 @@ will break at e.g. g_free() function without prior callers. It's possible to
 have proper library installed automatically by appropriate entry in Android.mk,
 see https://code.google.com/p/aosp-bluez.glib/ for an example.
 
+Enabling mgmt interface debugs
+==============================
+
+Mgmt logs can be enabled in runtime by setting "persist.sys.bluetooth.mgmtdbg"
+property to either literal "true" or any numeric value >0. For example:
+adb root
+adb shell setprop persist.sys.bluetooth.mgmtdbg 1
+
+After changing property value Bluetooth need to be restarted to apply changes.
+
 =============================
 Building and running on Linux
 =============================
diff --git a/android/bluetooth.c b/android/bluetooth.c
index 66177e5..2950513 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -145,6 +145,12 @@ static GSList *cached_devices = NULL;
 /* This list contains addresses which are asked for records */
 static GSList *browse_reqs;
 
+static void mgmt_debug(const char *str, void *user_data)
+{
+	const char *prefix = user_data;
+	info("%s%s", prefix, str);
+}
+
 static void store_adapter_config(void)
 {
 	GKeyFile *key_file;
@@ -2151,7 +2157,7 @@ failed:
 	cb(-EIO, NULL);
 }
 
-bool bt_bluetooth_start(int index, bt_bluetooth_ready cb)
+bool bt_bluetooth_start(int index, bool mgmt_dbg, bt_bluetooth_ready cb)
 {
 	DBG("index %d", index);
 
@@ -2161,6 +2167,9 @@ bool bt_bluetooth_start(int index, bt_bluetooth_ready cb)
 		return false;
 	}
 
+	if (mgmt_dbg)
+		mgmt_set_debug(mgmt_if, mgmt_debug, "mgmt_if: ", NULL);
+
 	if (mgmt_send(mgmt_if, MGMT_OP_READ_VERSION, MGMT_INDEX_NONE, 0, NULL,
 				read_version_complete, cb, NULL) == 0) {
 		error("Error sending READ_VERSION mgmt command");
diff --git a/android/bluetooth.h b/android/bluetooth.h
index 8ab34f6..1b7f3d4 100644
--- a/android/bluetooth.h
+++ b/android/bluetooth.h
@@ -22,7 +22,7 @@
  */
 
 typedef void (*bt_bluetooth_ready)(int err, const bdaddr_t *addr);
-bool bt_bluetooth_start(int index, bt_bluetooth_ready cb);
+bool bt_bluetooth_start(int index, bool mgmt_dbg, bt_bluetooth_ready cb);
 
 typedef void (*bt_bluetooth_stopped)(void);
 bool bt_bluetooth_stop(bt_bluetooth_stopped cb);
diff --git a/android/bluetoothd-wrapper.c b/android/bluetoothd-wrapper.c
index 3a9f32e..c98a3ce 100644
--- a/android/bluetoothd-wrapper.c
+++ b/android/bluetoothd-wrapper.c
@@ -24,10 +24,14 @@
 
 #define PROPERTY_VALGRIND_NAME "persist.sys.bluetooth.valgrind"
 
+#define PROPERTY_MGMT_DEBUG_NAME "persist.sys.bluetooth.mgmtdbg"
+
 #define VALGRIND_BIN "/system/bin/valgrind"
 
 #define BLUETOOTHD_BIN "/system/bin/bluetoothd-main"
 
+#define MGMT_DEBUG_PARAM "-d"
+
 static void run_valgrind(void)
 {
 	char *prg_argv[4];
@@ -45,13 +49,14 @@ static void run_valgrind(void)
 	execve(prg_argv[0], prg_argv, prg_envp);
 }
 
-static void run_bluetoothd(void)
+static void run_bluetoothd(int mgmt_debug)
 {
-	char *prg_argv[2];
+	char *prg_argv[3];
 	char *prg_envp[1];
 
 	prg_argv[0] = BLUETOOTHD_BIN;
-	prg_argv[1] = NULL;
+	prg_argv[1] = mgmt_debug ? MGMT_DEBUG_PARAM : NULL;
+	prg_argv[2] = NULL;
 
 	prg_envp[0] = NULL;
 
@@ -61,16 +66,22 @@ static void run_bluetoothd(void)
 int main(int argc, char *argv[])
 {
 	char value[PROPERTY_VALUE_MAX];
+	int mgmt_dbg = 0;
 
 	if (property_get(PROPERTY_VALGRIND_NAME, value, "") > 0 &&
 			(!strcasecmp(value, "true") || atoi(value) > 0))
 		run_valgrind();
 
+	if (property_get(PROPERTY_MGMT_DEBUG_NAME, value, "") > 0 &&
+			(!strcasecmp(value, "true") || atoi(value) > 0))
+			mgmt_dbg = 1;
+
+
 	/* In case we failed to execute Valgrind, try to run bluetoothd
 	 * without it
 	 */
 
-	run_bluetoothd();
+	run_bluetoothd(mgmt_dbg);
 
 	return 0;
 }
diff --git a/android/main.c b/android/main.c
index bf1dcfd..2c1d8e9 100644
--- a/android/main.c
+++ b/android/main.c
@@ -314,12 +314,15 @@ static guint setup_signalfd(void)
 
 static gboolean option_version = FALSE;
 static gint option_index = -1;
+static gint option_mgmt_dbg = FALSE;
 
 static GOptionEntry options[] = {
 	{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
 				"Show version information and exit", NULL },
 	{ "index", 'i', 0, G_OPTION_ARG_INT, &option_index,
 				"Use specified controller", "INDEX"},
+	{ "mgmt_debug", 'd', 0, G_OPTION_ARG_NONE, &option_mgmt_dbg,
+				"Enable mgmt interface debug logs", NULL},
 	{ NULL }
 };
 
@@ -454,7 +457,8 @@ int main(int argc, char *argv[])
 		return EXIT_FAILURE;
 	}
 
-	if (!bt_bluetooth_start(option_index, adapter_ready)) {
+	if (!bt_bluetooth_start(option_index, option_mgmt_dbg,
+							adapter_ready)) {
 		__btd_log_cleanup();
 		g_source_remove(bluetooth_start_timeout);
 		g_source_remove(signal);
-- 
1.8.4


^ permalink raw reply related

* Re: [PATCH BlueZ v7 07/11] gatt: Add external services tracking
From: Anderson Lizardo @ 2014-02-24 12:49 UTC (permalink / raw)
  To: Claudio Takahasi, BlueZ development, Alvaro Silva
In-Reply-To: <20140224083344.GA29475@x220.p-661hnu-f1>

Hi Johan,

On Mon, Feb 24, 2014 at 4:33 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> This whole timer thing seems too hackish to me.
>
> A better way to fix this might be to have something like
> g_dbus_client_set_proxies_complete_watch (or some better name) to let
> the code wait until GetManagedObjects has returned and the initial
> proxies added. Do you agree?

We came up with this workaround during development, but we forgot to
highlight on the cover letter. Indeed a function like the one you
propose should be enough.

Regarding the name for the function, I was thinking as
"g_dbus_client_proxies_ready_watch()". What do you think?


BTW, thanks for looking into these patches and beginning to apply them.

Best Regards,
-- 
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil

^ permalink raw reply

* Re: [PATCH BlueZ v7 07/11] gatt: Add external services tracking
From: Anderson Lizardo @ 2014-02-24 12:51 UTC (permalink / raw)
  To: Claudio Takahasi, BlueZ development, Alvaro Silva
In-Reply-To: <CAJdJm_OWfmjs2CbFxGP--nno0x5o+6R3FU5+nEP6VC7bjgNKJQ@mail.gmail.com>

Hi,

On Mon, Feb 24, 2014 at 8:49 AM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Johan,
>
> On Mon, Feb 24, 2014 at 4:33 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
>> This whole timer thing seems too hackish to me.
>>
>> A better way to fix this might be to have something like
>> g_dbus_client_set_proxies_complete_watch (or some better name) to let
>> the code wait until GetManagedObjects has returned and the initial
>> proxies added. Do you agree?
>
> We came up with this workaround during development, but we forgot to
> highlight on the cover letter. Indeed a function like the one you
> propose should be enough.
>
> Regarding the name for the function, I was thinking as
> "g_dbus_client_proxies_ready_watch()". What do you think?

Or "g_dbus_client_set_proxies_ready_watch()" to be consistent.

-- 
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil

^ permalink raw reply

* [PATCH 0/7] Bluetooth: Graceful power off procedure
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

This set of patches updates the power off procedure (as triggered
through mgmt) to perform a graceful power off by first cleaning up HCI
state such as connections, scan modes and advertising before requesting
the HCI driver to actually power off.

Johan

----------------------------------------------------------------
Johan Hedberg (7):
      Bluetooth: Add convenience function for getting total connection count
      Bluetooth: Move HCI_ADVERTISING handling into mgmt.c
      Bluetooth: Move check for MGMT_CONNECTED flag into mgmt.c
      Bluetooth: Don't clear HCI_DISCOVERABLE when powering off
      Bluetooth: Don't clear HCI_CONNECTABLE when powering off
      Bluetooth: Don't clear HCI_ADVERTISING when powering off
      Bluetooth: Clean up HCI state when doing power off

 include/net/bluetooth/hci_core.h | 11 ++++-
 net/bluetooth/hci_event.c        | 15 +++---
 net/bluetooth/mgmt.c             | 96 ++++++++++++++++++++++++++++++++++--
 3 files changed, 107 insertions(+), 15 deletions(-)


^ permalink raw reply

* [PATCH 1/7] Bluetooth: Add convenience function for getting total connection count
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

This patch adds a convenience function to return the number of
connections in the conn_hash list. This will be useful once we update
the power off procedure to disconnect any open connections.

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

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index fb3b677ff8a6..d2d756753714 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -561,6 +561,13 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
 	}
 }
 
+static inline unsigned int hci_conn_count(struct hci_dev *hdev)
+{
+	struct hci_conn_hash *c = &hdev->conn_hash;
+
+	return c->acl_num + c->amp_num + c->sco_num + c->le_num;
+}
+
 static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
 								__u16 handle)
 {
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 2/7] Bluetooth: Move HCI_ADVERTISING handling into mgmt.c
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

We'll soon need to make decisions on toggling the HCI_ADVERTISING flag
based on pending mgmt_set_powered commands. Therefore, move the handling
from hci_event.c into mgmt.c.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 include/net/bluetooth/hci_core.h | 1 +
 net/bluetooth/hci_event.c        | 8 ++------
 net/bluetooth/mgmt.c             | 8 ++++++++
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d2d756753714..6ff882e727d4 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1174,6 +1174,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered);
 void mgmt_discoverable_timeout(struct hci_dev *hdev);
 void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
 void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
+void mgmt_advertising(struct hci_dev *hdev, u8 advertising);
 void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
 void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
 		       bool persistent);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 064d619344b3..dea465ba276b 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -991,12 +991,8 @@ static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb)
 
 	hci_dev_lock(hdev);
 
-	if (!status) {
-		if (*sent)
-			set_bit(HCI_ADVERTISING, &hdev->dev_flags);
-		else
-			clear_bit(HCI_ADVERTISING, &hdev->dev_flags);
-	}
+	if (!status)
+		mgmt_advertising(hdev, *sent);
 
 	hci_dev_unlock(hdev);
 }
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9865e523df20..d39e57e9fed6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4832,6 +4832,14 @@ void mgmt_connectable(struct hci_dev *hdev, u8 connectable)
 		new_settings(hdev, NULL);
 }
 
+void mgmt_advertising(struct hci_dev *hdev, u8 advertising)
+{
+	if (advertising)
+		set_bit(HCI_ADVERTISING, &hdev->dev_flags);
+	else
+		clear_bit(HCI_ADVERTISING, &hdev->dev_flags);
+}
+
 void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status)
 {
 	u8 mgmt_err = mgmt_status(status);
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 3/7] Bluetooth: Move check for MGMT_CONNECTED flag into mgmt.c
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

Once mgmt_set_powered(off) starts doing disconnections we'll need to
care about any disconnections in mgmt.c and not just those with the
MGMT_CONNECTED flag set. Therefore, move the check into mgmt.c from
hci_event.c.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 include/net/bluetooth/hci_core.h | 3 ++-
 net/bluetooth/hci_event.c        | 7 ++++---
 net/bluetooth/mgmt.c             | 6 +++++-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 6ff882e727d4..269c8201a362 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1182,7 +1182,8 @@ void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
 			   u8 addr_type, u32 flags, u8 *name, u8 name_len,
 			   u8 *dev_class);
 void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
-			      u8 link_type, u8 addr_type, u8 reason);
+			      u8 link_type, u8 addr_type, u8 reason,
+			      bool mgmt_connected);
 void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
 			    u8 link_type, u8 addr_type, u8 status);
 void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index dea465ba276b..877cee844b9e 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1842,6 +1842,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 	struct hci_ev_disconn_complete *ev = (void *) skb->data;
 	u8 reason = hci_to_mgmt_reason(ev->reason);
 	struct hci_conn *conn;
+	bool mgmt_connected;
 	u8 type;
 
 	BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
@@ -1860,9 +1861,9 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 
 	conn->state = BT_CLOSED;
 
-	if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
-		mgmt_device_disconnected(hdev, &conn->dst, conn->type,
-					 conn->dst_type, reason);
+	mgmt_connected = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags);
+	mgmt_device_disconnected(hdev, &conn->dst, conn->type, conn->dst_type,
+				reason, mgmt_connected);
 
 	if (conn->type == ACL_LINK && conn->flush_key)
 		hci_remove_link_key(hdev, &conn->dst);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d39e57e9fed6..bdc831b3bb97 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -5012,11 +5012,15 @@ static void unpair_device_rsp(struct pending_cmd *cmd, void *data)
 }
 
 void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
-			      u8 link_type, u8 addr_type, u8 reason)
+			      u8 link_type, u8 addr_type, u8 reason,
+			      bool mgmt_connected)
 {
 	struct mgmt_ev_device_disconnected ev;
 	struct sock *sk = NULL;
 
+	if (!mgmt_connected)
+		return;
+
 	if (link_type != ACL_LINK && link_type != LE_LINK)
 		return;
 
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 4/7] Bluetooth: Don't clear HCI_DISCOVERABLE when powering off
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

Once mgmt_set_powered(off) is updated to clear the scan mode we should
not just blindly clear the HCI_DISCOVERABLE flag in mgmt_discoverable()
but first check if there is a pending set_powered operation.

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

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index bdc831b3bb97..769b5dc0270d 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4790,6 +4790,10 @@ void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
 	if (mgmt_pending_find(MGMT_OP_SET_DISCOVERABLE, hdev))
 		return;
 
+	/* Powering off may clear the scan mode - don't let that interfere */
+	if (!discoverable && mgmt_pending_find(MGMT_OP_SET_POWERED, hdev))
+		return;
+
 	if (discoverable) {
 		changed = !test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
 	} else {
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 5/7] Bluetooth: Don't clear HCI_CONNECTABLE when powering off
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

Once mgmt_set_powered(off) is updated to clear the scan mode we should
not just blindly clear the HCI_CONNECTABLE flag in mgmt_connectable()
but first check if there is a pending set_powered operation.

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

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 769b5dc0270d..5899ac7264ff 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4827,6 +4827,10 @@ void mgmt_connectable(struct hci_dev *hdev, u8 connectable)
 	if (mgmt_pending_find(MGMT_OP_SET_CONNECTABLE, hdev))
 		return;
 
+	/* Powering off may clear the scan mode - don't let that interfere */
+	if (!connectable && mgmt_pending_find(MGMT_OP_SET_POWERED, hdev))
+		return;
+
 	if (connectable)
 		changed = !test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
 	else
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 6/7] Bluetooth: Don't clear HCI_ADVERTISING when powering off
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

Once mgmt_set_powered(off) is updated to clear the scan mode we should
not just blindly clear the HCI_ADVERTISING flag in mgmt_advertising()
but first check if there is a pending set_powered operation.

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

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5899ac7264ff..610ac32e797b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4842,6 +4842,10 @@ void mgmt_connectable(struct hci_dev *hdev, u8 connectable)
 
 void mgmt_advertising(struct hci_dev *hdev, u8 advertising)
 {
+	/* Powering off may stop advertising - don't let that interfere */
+	if (!advertising && mgmt_pending_find(MGMT_OP_SET_POWERED, hdev))
+		return;
+
 	if (advertising)
 		set_bit(HCI_ADVERTISING, &hdev->dev_flags);
 	else
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH 7/7] Bluetooth: Clean up HCI state when doing power off
From: johan.hedberg @ 2014-02-24 12:52 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393246342-27980-1-git-send-email-johan.hedberg@gmail.com>

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

To be friendly to user space and to behave well with controllers that
lack a proper internal power off procedure we should try to clean up as
much state as possible before requesting the HCI driver to power off.

This patch updates the power off procedure that's triggered by
mgmt_set_powered to clean any scan modes, stop LE scanning and
advertising and to disconnect any open connections.

The asynchronous cleanup procedure uses the HCI request framework,
however since HCI_Disconnect is only covered until its Command Status
event we need some extra tracking/waiting of disconnections. This is
done by monitoring when hci_conn_count() indicates that there are no
more connections.

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

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 610ac32e797b..25b8b278debd 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1026,6 +1026,49 @@ static int send_settings_rsp(struct sock *sk, u16 opcode, struct hci_dev *hdev)
 			    sizeof(settings));
 }
 
+static void clean_up_hci_complete(struct hci_dev *hdev, u8 status)
+{
+	BT_DBG("%s status 0x%02x", hdev->name, status);
+
+	if (hci_conn_count(hdev) == 0)
+		queue_work(hdev->req_workqueue, &hdev->power_off.work);
+}
+
+static int clean_up_hci_state(struct hci_dev *hdev)
+{
+	struct hci_request req;
+	struct hci_conn *conn;
+
+	hci_req_init(&req, hdev);
+
+	if (test_bit(HCI_ISCAN, &hdev->flags) ||
+	    test_bit(HCI_PSCAN, &hdev->flags)) {
+		u8 scan = 0x00;
+		hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
+	}
+
+	if (test_bit(HCI_ADVERTISING, &hdev->dev_flags))
+		disable_advertising(&req);
+
+	if (test_bit(HCI_LE_SCAN, &hdev->dev_flags)) {
+		struct hci_cp_le_set_scan_enable cp;
+
+		memset(&cp, 0, sizeof(cp));
+		cp.enable = LE_SCAN_DISABLE;
+		hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
+	}
+
+	list_for_each_entry(conn, &hdev->conn_hash.list, list) {
+		struct hci_cp_disconnect dc;
+
+		dc.handle = cpu_to_le16(conn->handle);
+		dc.reason = 0x15; /* Terminated due to Power Off */
+		hci_req_add(&req, HCI_OP_DISCONNECT, sizeof(dc), &dc);
+	}
+
+	return hci_req_run(&req, clean_up_hci_complete);
+}
+
 static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
 		       u16 len)
 {
@@ -1069,12 +1112,19 @@ static int set_powered(struct sock *sk, struct hci_dev *hdev, void *data,
 		goto failed;
 	}
 
-	if (cp->val)
+	if (cp->val) {
 		queue_work(hdev->req_workqueue, &hdev->power_on);
-	else
-		queue_work(hdev->req_workqueue, &hdev->power_off.work);
+		err = 0;
+	} else {
+		/* Disconnect connections, stop scans, etc */
+		err = clean_up_hci_state(hdev);
 
-	err = 0;
+		/* ENODATA means there were no HCI commands queued */
+		if (err == -ENODATA) {
+			queue_work(hdev->req_workqueue, &hdev->power_off.work);
+			err = 0;
+		}
+	}
 
 failed:
 	hci_dev_unlock(hdev);
@@ -5028,8 +5078,20 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
 			      bool mgmt_connected)
 {
 	struct mgmt_ev_device_disconnected ev;
+	struct pending_cmd *power_off;
 	struct sock *sk = NULL;
 
+	power_off = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev);
+	if (power_off) {
+		struct mgmt_mode *cp = power_off->param;
+
+		/* The connection is still in hci_conn_hash so test for 1
+		 * instead of 0 to know if this is the last one.
+		 */
+		if (!cp->val && hci_conn_count(hdev) == 1)
+			queue_work(hdev->req_workqueue, &hdev->power_off.work);
+	}
+
 	if (!mgmt_connected)
 		return;
 
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH] android/avctp: Set uinput to invalid fd when creating session
From: Andrei Emeltchenko @ 2014-02-24 13:12 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

When AVCTP session was created uinput was zero which is valid file
descriptor and that was conflicting with socketpair() fds.
---
 android/avctp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/android/avctp.c b/android/avctp.c
index 1e414d1..9bfb191 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -1414,6 +1414,7 @@ struct avctp *avctp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
 		return NULL;
 	}
 
+	session->uinput = -1;
 	session->control = control;
 	session->passthrough_id = avctp_register_pdu_handler(session,
 						AVC_OP_PASSTHROUGH,
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 1/3] unit/avrcp: Refactor tests to use destroy_context()
From: Andrei Emeltchenko @ 2014-02-24 13:25 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

---
 unit/test-avrcp.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 381e7cb..e9fe7e3 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -246,15 +246,7 @@ static void execute_context(struct context *context)
 {
 	g_main_loop_run(context->main_loop);
 
-	if (context->source > 0)
-		g_source_remove(context->source);
-
-	avrcp_shutdown(context->session);
-
-	g_main_loop_unref(context->main_loop);
-
-	test_free(context->data);
-	g_free(context);
+	destroy_context(context);
 }
 
 static void test_server(gconstpointer data)
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 2/3] unit/avrcp: Add /TP/PTT/BV-01-I test
From: Andrei Emeltchenko @ 2014-02-24 13:25 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393248318-5188-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Test verifies that the Target reacts to the PASS THROUGH command in
category 1 from the Controller. The command chosen is PLAY (0x44).
---
 unit/test-avrcp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index e9fe7e3..9d2e56a 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -291,5 +291,11 @@ int main(int argc, char *argv[])
 			raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0xf8, 0x31,
 				0x07, 0x48, 0xff, 0xff, 0xff));
 
+	define_test("/TP/PTT/BV-01-I", test_server,
+			raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x7c,
+				0x44, 0x00),
+			raw_pdu(0x02, 0x11, 0x0e, 0x09, 0x48, 0x7c,
+				0x44, 0x00));
+
 	return g_test_run();
 }
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 3/3] android/avctp: Set uinput to invalid fd when creating session
From: Andrei Emeltchenko @ 2014-02-24 13:25 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1393248318-5188-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

When AVCTP session was created uinput was zero which is valid file
descriptor and that was conflicting with socketpair() fds.
---
 android/avctp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/android/avctp.c b/android/avctp.c
index 1e414d1..9bfb191 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -1414,6 +1414,7 @@ struct avctp *avctp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
 		return NULL;
 	}
 
+	session->uinput = -1;
 	session->control = control;
 	session->passthrough_id = avctp_register_pdu_handler(session,
 						AVC_OP_PASSTHROUGH,
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH] android/pixit: Add PIXIT for HFP
From: Sebastian Chlad @ 2014-02-24 15:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sebastian Chlad

---
 android/Makefile.am   |  1 +
 android/pixit-hfp.txt | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 android/pixit-hfp.txt

diff --git a/android/Makefile.am b/android/Makefile.am
index 58cfbae..b17b9fe 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -201,6 +201,7 @@ EXTRA_DIST += android/Android.mk android/README \
 				android/pixit-avctp.txt \
 				android/pixit-avrcp.txt \
 				android/pixit-hsp.txt \
+				android/pixit-hfp.txt \
 				android/pts-l2cap.txt \
 				android/pts-gap.txt \
 				android/pts-did.txt \
diff --git a/android/pixit-hfp.txt b/android/pixit-hfp.txt
new file mode 100644
index 0000000..aa50b1f
--- /dev/null
+++ b/android/pixit-hfp.txt
@@ -0,0 +1,37 @@
+HFP PIXIT for the PTS tool.
+
+PTS version: 5.0
+
+* - different than PTS defaults
+& - should be set to IUT Bluetooth address
+# - should be set to the respective phone numbers
+
+		Required PIXIT settings
+-------------------------------------------------------------------------------
+Parameter Name						Value
+-------------------------------------------------------------------------------
+TSPX_security_enabled					TRUE
+TSPX_bd_addr_iut					08606E414394 (&)
+TSPX_hf_class_of_device					200408
+TSPX_ag_class_of_device					400204
+TSPX_packet_type_sco					00A0
+TSPX_phone_number					1234567 (#)
+TSPX_second_phone_number				7654321 (#)
+TSPX_phone_number_type					129
+TSPX_second_phone_number_type				129
+TSPX_phone_number_memory				1
+TSPX_phone_number_memory_invalid_index			9999
+TSPX_scan_all_memory_dial_locations			FALSE
+TSPX_pin_code						0000
+TSPX_time_guard						300000
+TSPX_use_implicit_send					TRUE
+TSPX_verbose_implicit_send				FALSE
+TSPX_delete_link_key					FALSE
+TSPX_server_channel_tester				01
+TSPX_server_channel_iut					00
+TSPX_verify_CLIP_information				TRUE
+TSPX_no_fail_verdict					FALSE
+TSPX_network_supports_correct_call_and_callstatus	TRUE
+TSPX_secure_simple_pairing_pass_key_confirmation	FALSE
+TSPX_AG_match_tester_BRSF_codec_negotiation_bit		FALSE
+-------------------------------------------------------------------------------
-- 
1.8.5.3


^ permalink raw reply related

* [PATCH] android/pixit: Correct symbols in PIXIT
From: Sebastian Chlad @ 2014-02-24 15:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sebastian Chlad

Trivial patch correcting PIXIT files for HFP and HSP
---
 android/pixit-hfp.txt | 2 +-
 android/pixit-hsp.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/pixit-hfp.txt b/android/pixit-hfp.txt
index aa50b1f..3134b26 100644
--- a/android/pixit-hfp.txt
+++ b/android/pixit-hfp.txt
@@ -11,7 +11,7 @@ PTS version: 5.0
 Parameter Name						Value
 -------------------------------------------------------------------------------
 TSPX_security_enabled					TRUE
-TSPX_bd_addr_iut					08606E414394 (&)
+TSPX_bd_addr_iut					08606E414394 (*&)
 TSPX_hf_class_of_device					200408
 TSPX_ag_class_of_device					400204
 TSPX_packet_type_sco					00A0
diff --git a/android/pixit-hsp.txt b/android/pixit-hsp.txt
index 2bda4fa..62293a6 100644
--- a/android/pixit-hsp.txt
+++ b/android/pixit-hsp.txt
@@ -10,7 +10,7 @@ PTS version: 5.0
 Parameter Name						Value
 -------------------------------------------------------------------------------
 TSPX_security_enabled					TRUE
-TSPX_bd_addr_iut					08606E414394 (&)
+TSPX_bd_addr_iut					08606E414394 (*&)
 TSPX_hs_class_of_device					200404
 TSPX_ag_class_of_device					400204
 TSPX_packet_type_sco					00A0
-- 
1.8.5.3


^ permalink raw reply related

* Re: [PATCH 1/3] unit/avrcp: Refactor tests to use destroy_context()
From: Luiz Augusto von Dentz @ 2014-02-24 16:17 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1393248318-5188-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

On Mon, Feb 24, 2014 at 3:25 PM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> ---
>  unit/test-avrcp.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
> index 381e7cb..e9fe7e3 100644
> --- a/unit/test-avrcp.c
> +++ b/unit/test-avrcp.c
> @@ -246,15 +246,7 @@ static void execute_context(struct context *context)
>  {
>         g_main_loop_run(context->main_loop);
>
> -       if (context->source > 0)
> -               g_source_remove(context->source);
> -
> -       avrcp_shutdown(context->session);
> -
> -       g_main_loop_unref(context->main_loop);
> -
> -       test_free(context->data);
> -       g_free(context);
> +       destroy_context(context);
>  }
>
>  static void test_server(gconstpointer data)
> --
> 1.8.3.2

Pushed with some changes to patch 2/3 to actually add a callback to
handle AVC_PLAY.


-- 
Luiz Augusto von Dentz

^ permalink raw reply

* [PATCH] Bluetooth: Fix bluetooth.h for inclusion in clang projects
From: Donald Carr @ 2014-02-24 16:38 UTC (permalink / raw)
  To: linux-bluetooth

>From b12351dacb8e7fc44668ab4011db1d1b2b83e883 Mon Sep 17 00:00:00 2001
From: Donald Carr <sirspudd@gmail.com>
Date: Mon, 24 Feb 2014 08:34:46 -0800
Subject: [PATCH] Move from typeof gcc intrinsic to __typeof__

Change-Id: Ic3aa6ec1446876bfabdcc5e120ec327e177ffc74
---
 lib/bluetooth.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index 61c1f9a..bc9b35e 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -158,16 +158,16 @@ enum {
 #define bt_get_unaligned(ptr)                  \
 ({                                             \
        struct __attribute__((packed)) {        \
-               typeof(*(ptr)) __v;             \
-       } *__p = (typeof(__p)) (ptr);           \
+               __typeof__(*(ptr)) __v;         \
+       } *__p = (__typeof__(__p)) (ptr);               \
        __p->__v;                               \
 })

 #define bt_put_unaligned(val, ptr)             \
 do {                                           \
        struct __attribute__((packed)) {        \
-               typeof(*(ptr)) __v;             \
-       } *__p = (typeof(__p)) (ptr);           \
+               __typeof__(*(ptr)) __v;         \
+       } *__p = (__typeof__(__p)) (ptr);               \
        __p->__v = (val);                       \
 } while(0)

--
1.9.0

-- 
-------------------------------
 °v°  Donald Carr
/(_)\ Vaguely Professional Penguin lover
 ^ ^

Cave canem, te necet lingendo

^ permalink raw reply related

* Re: [PATCH] android/pics: Add PICS and PIXIT for HSP
From: Marcel Holtmann @ 2014-02-24 17:57 UTC (permalink / raw)
  To: Sebastian Chlad; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <1393242895-19447-1-git-send-email-sebastian.chlad@tieto.com>

Hi Sebastian,

> Added PICS and PIXIT target Android 4.4
> ---
> android/Makefile.am   |   2 +
> android/pics-hsp.txt  | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++
> android/pixit-hsp.txt |  30 +++++++++++++++
> 3 files changed, 135 insertions(+)
> create mode 100644 android/pics-hsp.txt
> create mode 100644 android/pixit-hsp.txt

so we are doing Headset profile (HSP) and also Handsfree profile (HFP). I am fine with also doing HSP since it seems that is what Android uses on tablets.

Regards

Marcel


^ permalink raw reply


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