2014-06-27 10:08:01

by Jakub Tyszkowski

[permalink] [raw]
Subject: [PATCHv2 1/3] android/mcaptest: Send clock sync capabilities request

This adds option to send synchronization capabilities and requirements
request on MCL connection.
---
android/mcaptest.c | 43 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/android/mcaptest.c b/android/mcaptest.c
index 9869abb..642dbf4 100644
--- a/android/mcaptest.c
+++ b/android/mcaptest.c
@@ -57,6 +57,7 @@ static uint16_t mdlid;
static int control_mode = MODE_LISTEN;
static int data_mode = MODE_LISTEN;

+static gboolean send_synccap_req = FALSE;
static gboolean mcl_disconnect = FALSE;
static gboolean mdl_disconnect = FALSE;
static int mcl_disconnect_timeout = -1;
@@ -64,6 +65,8 @@ static int mdl_disconnect_timeout = -1;

static struct mcap_mcl *mcl = NULL;

+#define REQ_CLOCK_ACC 0x1400
+
static void mdl_connected_cb(struct mcap_mdl *mdl, void *data)
{
int fd = -1;
@@ -178,6 +181,15 @@ static void create_mdl_cb(struct mcap_mdl *mcap_mdl, uint8_t type, GError *gerr,
}
}

+static void sync_cap_cb(struct mcap_mcl *mcl, uint8_t mcap_err,
+ uint8_t btclockres, uint16_t synclead,
+ uint16_t tmstampres, uint16_t tmstampacc, GError *err,
+ gpointer data)
+{
+ /* TODO */
+ printf("%s\n", __func__);
+}
+
static void trigger_mdl_action(int mode)
{
GError *gerr = NULL;
@@ -205,14 +217,26 @@ static void trigger_mdl_action(int mode)
g_error_free(gerr);
}
}
+
+ if (send_synccap_req && mcap->csp_enabled) {
+ mcap_sync_init(mcl);
+
+ mcap_sync_cap_req(mcl, REQ_CLOCK_ACC, sync_cap_cb, NULL, &gerr);
+ if (gerr) {
+ printf("MCAP Sync req error: %s\n", gerr->message);
+ g_error_free(gerr);
+ }
+ }
}

static void mcl_connected(struct mcap_mcl *mcap_mcl, gpointer data)
{
printf("%s\n", __func__);

- if (mcl)
+ if (mcl) {
+ mcap_sync_stop(mcl);
mcap_mcl_unref(mcl);
+ }

mcl = mcap_mcl_ref(mcap_mcl);
trigger_mdl_action(data_mode);
@@ -226,8 +250,10 @@ static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer data)
return;
}

- if (mcl)
+ if (mcl) {
+ mcap_sync_stop(mcl);
mcap_mcl_unref(mcl);
+ }

mcl = mcap_mcl_ref(mcap_mcl);
trigger_mdl_action(data_mode);
@@ -239,7 +265,8 @@ static void usage(void)
"\tmcaptest <control_mode> <data_mode> [options]\n");
printf("Control Link Mode:\n"
"\t-c connect <dst_addr>\n"
- "\t-e <timeout> disconnect MCL and quit after MDL is closed\n");
+ "\t-e <timeout> disconnect MCL and quit after MDL is closed\n"
+ "\t-g send clock sync capability request if MCL connected\n");
printf("Data Link Mode:\n"
"\t-d connect\n"
"\t-f <timeout> disconnect MDL after it's connected\n");
@@ -254,6 +281,7 @@ static struct option main_options[] = {
{ "device", 1, 0, 'i' },
{ "connect_cl", 1, 0, 'c' },
{ "disconnect_cl", 1, 0, 'e' },
+ { "synccap_req", 0, 0, 'g' },
{ "connect_dl", 0, 0, 'd' },
{ "disconnect_dl", 1, 0, 'f' },
{ "control_ch", 1, 0, 'C' },
@@ -277,7 +305,7 @@ int main(int argc, char *argv[])
exit(1);
}

- while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:hd",
+ while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dgh",
main_options, NULL)) != EOF) {
switch (opt) {
case 'i':
@@ -311,6 +339,11 @@ int main(int argc, char *argv[])

break;

+ case 'g':
+ send_synccap_req = TRUE;
+
+ break;
+
case 'C':
ccpsm = atoi(optarg);

@@ -341,6 +374,8 @@ int main(int argc, char *argv[])
exit(1);
}

+ mcap_enable_csp(mcap);
+
switch (control_mode) {
case MODE_CONNECT:
ba2str(&dst, bdastr);
--
2.0.0



2014-06-27 12:36:35

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCHv2 1/3] android/mcaptest: Send clock sync capabilities request

Hi Jakub,

On Friday 27 of June 2014 12:08:01 Jakub Tyszkowski wrote:
> This adds option to send synchronization capabilities and requirements
> request on MCL connection.
> ---
> android/mcaptest.c | 43 +++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 39 insertions(+), 4 deletions(-)
>
> diff --git a/android/mcaptest.c b/android/mcaptest.c
> index 9869abb..642dbf4 100644
> --- a/android/mcaptest.c
> +++ b/android/mcaptest.c
> @@ -57,6 +57,7 @@ static uint16_t mdlid;
> static int control_mode = MODE_LISTEN;
> static int data_mode = MODE_LISTEN;
>
> +static gboolean send_synccap_req = FALSE;
> static gboolean mcl_disconnect = FALSE;
> static gboolean mdl_disconnect = FALSE;
> static int mcl_disconnect_timeout = -1;
> @@ -64,6 +65,8 @@ static int mdl_disconnect_timeout = -1;
>
> static struct mcap_mcl *mcl = NULL;
>
> +#define REQ_CLOCK_ACC 0x1400
> +
> static void mdl_connected_cb(struct mcap_mdl *mdl, void *data)
> {
> int fd = -1;
> @@ -178,6 +181,15 @@ static void create_mdl_cb(struct mcap_mdl *mcap_mdl, uint8_t type, GError *gerr,
> }
> }
>
> +static void sync_cap_cb(struct mcap_mcl *mcl, uint8_t mcap_err,
> + uint8_t btclockres, uint16_t synclead,
> + uint16_t tmstampres, uint16_t tmstampacc, GError *err,
> + gpointer data)
> +{
> + /* TODO */
> + printf("%s\n", __func__);
> +}
> +
> static void trigger_mdl_action(int mode)
> {
> GError *gerr = NULL;
> @@ -205,14 +217,26 @@ static void trigger_mdl_action(int mode)
> g_error_free(gerr);
> }
> }
> +
> + if (send_synccap_req && mcap->csp_enabled) {
> + mcap_sync_init(mcl);
> +
> + mcap_sync_cap_req(mcl, REQ_CLOCK_ACC, sync_cap_cb, NULL, &gerr);
> + if (gerr) {
> + printf("MCAP Sync req error: %s\n", gerr->message);
> + g_error_free(gerr);
> + }
> + }
> }
>
> static void mcl_connected(struct mcap_mcl *mcap_mcl, gpointer data)
> {
> printf("%s\n", __func__);
>
> - if (mcl)
> + if (mcl) {
> + mcap_sync_stop(mcl);
> mcap_mcl_unref(mcl);
> + }
>
> mcl = mcap_mcl_ref(mcap_mcl);
> trigger_mdl_action(data_mode);
> @@ -226,8 +250,10 @@ static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer data)
> return;
> }
>
> - if (mcl)
> + if (mcl) {
> + mcap_sync_stop(mcl);
> mcap_mcl_unref(mcl);
> + }
>
> mcl = mcap_mcl_ref(mcap_mcl);
> trigger_mdl_action(data_mode);
> @@ -239,7 +265,8 @@ static void usage(void)
> "\tmcaptest <control_mode> <data_mode> [options]\n");
> printf("Control Link Mode:\n"
> "\t-c connect <dst_addr>\n"
> - "\t-e <timeout> disconnect MCL and quit after MDL is closed\n");
> + "\t-e <timeout> disconnect MCL and quit after MDL is closed\n"
> + "\t-g send clock sync capability request if MCL connected\n");
> printf("Data Link Mode:\n"
> "\t-d connect\n"
> "\t-f <timeout> disconnect MDL after it's connected\n");
> @@ -254,6 +281,7 @@ static struct option main_options[] = {
> { "device", 1, 0, 'i' },
> { "connect_cl", 1, 0, 'c' },
> { "disconnect_cl", 1, 0, 'e' },
> + { "synccap_req", 0, 0, 'g' },
> { "connect_dl", 0, 0, 'd' },
> { "disconnect_dl", 1, 0, 'f' },
> { "control_ch", 1, 0, 'C' },
> @@ -277,7 +305,7 @@ int main(int argc, char *argv[])
> exit(1);
> }
>
> - while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:hd",
> + while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dgh",
> main_options, NULL)) != EOF) {
> switch (opt) {
> case 'i':
> @@ -311,6 +339,11 @@ int main(int argc, char *argv[])
>
> break;
>
> + case 'g':
> + send_synccap_req = TRUE;
> +
> + break;
> +
> case 'C':
> ccpsm = atoi(optarg);
>
> @@ -341,6 +374,8 @@ int main(int argc, char *argv[])
> exit(1);
> }
>
> + mcap_enable_csp(mcap);
> +
> switch (control_mode) {
> case MODE_CONNECT:
> ba2str(&dst, bdastr);
>

All patches applied, thanks.

--
Best regards,
Szymon Janc

2014-06-27 10:08:03

by Jakub Tyszkowski

[permalink] [raw]
Subject: [PATCHv2 3/3] android/pts: Update MCAP results

---
android/pts-mcap.txt | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/android/pts-mcap.txt b/android/pts-mcap.txt
index 9542b8c..55b51d7 100644
--- a/android/pts-mcap.txt
+++ b/android/pts-mcap.txt
@@ -1,7 +1,7 @@
PTS test results for MCAP

PTS version: 5.1
-Tested: 26-June-2014
+Tested: 27-June-2014
Android version: 4.4.2

Results:
@@ -10,6 +10,9 @@ FAIL test failed
INC test is inconclusive
N/A test is disabled due to PICS setup

+Note: Test were done with ssp enabled and in most of the cases requires pairing
+ confirmation. This can be done easily by using 'btmgmt monitor'.
+
-------------------------------------------------------------------------------
Test Name Result Notes
-------------------------------------------------------------------------------
@@ -32,7 +35,10 @@ TC_MCAP_CM_DIS_BV_05_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_CM_REC_BV_01_C N/A
TC_MCAP_CM_REC_BV_02_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_CM_REC_BV_03_C N/A
-TC_MCAP_CM_REC_BV_04_C INC possible PTS issue #12182
+TC_MCAP_CM_REC_BV_04_C PASS mcaptest -C 4099 -D 4101
+ Note: It may be necessary to confirm pairing
+ twice (second time when UIT is back in
+ range).
TC_MCAP_CM_REC_BV_05_C N/A
TC_MCAP_CM_REC_BV_06_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_CS_ERR_BI_01_C N/A
@@ -58,15 +64,15 @@ TC_MCAP_ERR_BI_08_C PASS mcaptest -C 4099 -D 4101 -d
TC_MCAP_ERR_BI_09_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_ERR_BI_10_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_ERR_BI_11_C PASS mcaptest -C 4099 -D 4101 -d
-TC_MCAP_ERR_BI_12_C INC
+TC_MCAP_ERR_BI_12_C PASS mcaptest -C 4099 -D 4101 -d
TC_MCAP_ERR_BI_13_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_ERR_BI_14_C PASS mcaptest -C 4099 -D 4101
TC_MCAP_ERR_BI_15_C PASS mcaptest -C 4099 -D 4101 -d
-TC_MCAP_ERR_BI_16_C INC
+TC_MCAP_ERR_BI_16_C PASS mcaptest -C 4099 -D 4101 -u
TC_MCAP_ERR_BI_17_C PASS mcaptest -C 4099 -D 4101 -d
TC_MCAP_ERR_BI_18_C PASS mcaptest -C 4099 -D 4101 -d
TC_MCAP_ERR_BI_19_C PASS mcaptest -C 4099 -D 4101
-TC_MCAP_ERR_BI_20_C INC
+TC_MCAP_ERR_BI_20_C PASS mcaptest -C 4099 -D 4101 -g
TC_MCAP_INV_BI_01_C PASS mcaptest -C 4099 -D 4101 -dc <PTS addr>
TC_MCAP_INV_BI_02_C PASS mcaptest -C 4099 -D 4101 -d
TC_MCAP_INV_BI_03_C PASS mcaptest -C 4099 -D 4101 -dc <PTS addr>
--
2.0.0


2014-06-27 10:08:02

by Jakub Tyszkowski

[permalink] [raw]
Subject: [PATCHv2 2/3] android/mcaptest: Support unavailable response to first MDL connect

This is needed to pass TC_MCAP_ERR_BI_16_C
---
android/mcaptest.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/android/mcaptest.c b/android/mcaptest.c
index 642dbf4..f727a79 100644
--- a/android/mcaptest.c
+++ b/android/mcaptest.c
@@ -57,6 +57,8 @@ static uint16_t mdlid;
static int control_mode = MODE_LISTEN;
static int data_mode = MODE_LISTEN;

+static int mdl_conn_req_result = MCAP_SUCCESS;
+
static gboolean send_synccap_req = FALSE;
static gboolean mcl_disconnect = FALSE;
static gboolean mdl_disconnect = FALSE;
@@ -109,9 +111,15 @@ static void mdl_aborted_cb(struct mcap_mdl *mdl, void *data)
static uint8_t mdl_conn_req_cb(struct mcap_mcl *mcl, uint8_t mdepid,
uint16_t mdlid, uint8_t *conf, void *data)
{
+ int ret;
+
printf("%s\n", __func__);

- return MCAP_SUCCESS;
+ ret = mdl_conn_req_result;
+
+ mdl_conn_req_result = MCAP_SUCCESS;
+
+ return ret;
}

static uint8_t mdl_reconn_req_cb(struct mcap_mdl *mdl, void *data)
@@ -269,7 +277,8 @@ static void usage(void)
"\t-g send clock sync capability request if MCL connected\n");
printf("Data Link Mode:\n"
"\t-d connect\n"
- "\t-f <timeout> disconnect MDL after it's connected\n");
+ "\t-f <timeout> disconnect MDL after it's connected\n"
+ "\t-u send \'Unavailable\' on first MDL connection request\n");
printf("Options:\n"
"\t-i <hcidev> HCI device\n"
"\t-C <control_ch> Control channel PSM\n"
@@ -284,6 +293,7 @@ static struct option main_options[] = {
{ "synccap_req", 0, 0, 'g' },
{ "connect_dl", 0, 0, 'd' },
{ "disconnect_dl", 1, 0, 'f' },
+ { "unavailable_dl", 0, 0, 'u' },
{ "control_ch", 1, 0, 'C' },
{ "data_ch", 1, 0, 'D' },
{ 0, 0, 0, 0 }
@@ -305,7 +315,7 @@ int main(int argc, char *argv[])
exit(1);
}

- while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dgh",
+ while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dghu",
main_options, NULL)) != EOF) {
switch (opt) {
case 'i':
@@ -344,6 +354,11 @@ int main(int argc, char *argv[])

break;

+ case 'u':
+ mdl_conn_req_result = MCAP_RESOURCE_UNAVAILABLE;
+
+ break;
+
case 'C':
ccpsm = atoi(optarg);

--
2.0.0