linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log
@ 2014-10-30 11:05 Grzegorz Kolodziejczyk
  0 siblings, 0 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-10-30 11:05 UTC (permalink / raw)
  To: linux-bluetooth

Loging state of MCAP channels is very helpful while analyzing
connection.
---
 tools/mcaptest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/mcaptest.c b/tools/mcaptest.c
index dd638c9..6d50544 100644
--- a/tools/mcaptest.c
+++ b/tools/mcaptest.c
@@ -257,6 +257,8 @@ static void mcl_connected(struct mcap_mcl *mcap_mcl, gpointer data)
 
 static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer data)
 {
+	printf("%s\n", __func__);
+
 	if (err) {
 		printf("Could not connect MCL: %s\n", err->message);
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log
@ 2014-10-30 11:15 Grzegorz Kolodziejczyk
  2014-10-30 11:15 ` [PATCH v2 2/2] tools/mcaptest: Add no close paramameter Grzegorz Kolodziejczyk
  2014-10-31 19:15 ` [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log Szymon Janc
  0 siblings, 2 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-10-30 11:15 UTC (permalink / raw)
  To: linux-bluetooth

Loging state of MCAP channels is very helpful while analyzing
connection.
---
 tools/mcaptest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/mcaptest.c b/tools/mcaptest.c
index dd638c9..6d50544 100644
--- a/tools/mcaptest.c
+++ b/tools/mcaptest.c
@@ -257,6 +257,8 @@ static void mcl_connected(struct mcap_mcl *mcap_mcl, gpointer data)
 
 static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer data)
 {
+	printf("%s\n", __func__);
+
 	if (err) {
 		printf("Could not connect MCL: %s\n", err->message);
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] tools/mcaptest: Add no close paramameter
  2014-10-30 11:15 [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log Grzegorz Kolodziejczyk
@ 2014-10-30 11:15 ` Grzegorz Kolodziejczyk
  2014-10-31 19:15 ` [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log Szymon Janc
  1 sibling, 0 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-10-30 11:15 UTC (permalink / raw)
  To: linux-bluetooth

If parametr is given mcaptest don't exit after: receiving err, or while
MCL disconnects. This is needed while reconnecting MCL or some PTS
test cases:
TC_MCAP_CM_REC_BV_x_C - test cases branch
TC_MCAP_ERR_BI_x_C - test cases branch
---
 tools/mcaptest.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/tools/mcaptest.c b/tools/mcaptest.c
index 6d50544..42734eb 100644
--- a/tools/mcaptest.c
+++ b/tools/mcaptest.c
@@ -67,6 +67,8 @@ static int mdl_disconnect_timeout = -1;
 
 static struct mcap_mcl *mcl = NULL;
 
+static gboolean no_close = FALSE;
+
 #define REQ_CLOCK_ACC 0x1400
 
 static void mdl_connected_cb(struct mcap_mdl *mdl, void *data)
@@ -152,6 +154,9 @@ static void mcl_disconnected(struct mcap_mcl *mcl, gpointer data)
 	/* TODO */
 	printf("MCL disconnected\n");
 
+	if (no_close)
+		return;
+
 	g_main_loop_quit(mloop);
 }
 
@@ -176,7 +181,9 @@ static void create_mdl_cb(struct mcap_mdl *mcap_mdl, uint8_t type, GError *gerr,
 	if (gerr) {
 		printf("MDL error: %s\n", gerr->message);
 
-		g_main_loop_quit(mloop);
+		if (!no_close)
+			g_main_loop_quit(mloop);
+
 		return;
 	}
 
@@ -190,6 +197,9 @@ static void create_mdl_cb(struct mcap_mdl *mcap_mdl, uint8_t type, GError *gerr,
 		printf("Error connecting to mdl: %s\n", err->message);
 		g_error_free(err);
 
+		if (no_close)
+			return;
+
 		g_main_loop_quit(mloop);
 	}
 }
@@ -262,7 +272,9 @@ static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer data)
 	if (err) {
 		printf("Could not connect MCL: %s\n", err->message);
 
-		g_main_loop_quit(mloop);
+		if (!no_close)
+			g_main_loop_quit(mloop);
+
 		return;
 	}
 
@@ -288,6 +300,7 @@ static void usage(void)
 		"\t-f <timeout> disconnect MDL after it's connected\n"
 		"\t-u send \'Unavailable\' on first MDL connection request\n");
 	printf("Options:\n"
+		"\t-n don't exit after mcl disconnect/err receive\n"
 		"\t-i <hcidev>        HCI device\n"
 		"\t-C <control_ch>    Control channel PSM\n"
 		"\t-D <data_ch>       Data channel PSM\n");
@@ -302,6 +315,7 @@ static struct option main_options[] = {
 	{ "connect_dl",		0, 0, 'd' },
 	{ "disconnect_dl",	1, 0, 'f' },
 	{ "unavailable_dl",	0, 0, 'u' },
+	{ "no exit mcl dis/err",0, 0, 'n' },
 	{ "control_ch",		1, 0, 'C' },
 	{ "data_ch",		1, 0, 'D' },
 	{ 0, 0, 0, 0 }
@@ -323,7 +337,7 @@ int main(int argc, char *argv[])
 		exit(1);
 	}
 
-	while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dghu",
+	while ((opt = getopt_long(argc, argv, "+i:c:C:D:e:f:dghun",
 						main_options, NULL)) != EOF) {
 		switch (opt) {
 		case 'i':
@@ -367,6 +381,11 @@ int main(int argc, char *argv[])
 
 			break;
 
+		case 'n':
+			no_close = TRUE;
+
+			break;
+
 		case 'C':
 			ccpsm = atoi(optarg);
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log
  2014-10-30 11:15 [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log Grzegorz Kolodziejczyk
  2014-10-30 11:15 ` [PATCH v2 2/2] tools/mcaptest: Add no close paramameter Grzegorz Kolodziejczyk
@ 2014-10-31 19:15 ` Szymon Janc
  1 sibling, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-10-31 19:15 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Thursday 30 of October 2014 12:15:06 Grzegorz Kolodziejczyk wrote:
> Loging state of MCAP channels is very helpful while analyzing
> connection.
> ---
>  tools/mcaptest.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/mcaptest.c b/tools/mcaptest.c
> index dd638c9..6d50544 100644
> --- a/tools/mcaptest.c
> +++ b/tools/mcaptest.c
> @@ -257,6 +257,8 @@ static void mcl_connected(struct mcap_mcl *mcap_mcl,
> gpointer data)
> 
>  static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer
> data) {
> +	printf("%s\n", __func__);
> +
>  	if (err) {
>  		printf("Could not connect MCL: %s\n", err->message);

Applied, thanks.

-- 
BR
Szymon Janc

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-31 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 11:15 [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log Grzegorz Kolodziejczyk
2014-10-30 11:15 ` [PATCH v2 2/2] tools/mcaptest: Add no close paramameter Grzegorz Kolodziejczyk
2014-10-31 19:15 ` [PATCH v2 1/2] tools/mcaptest: Add missing MCL connected log Szymon Janc
  -- strict thread matches above, loose matches on Subject: below --
2014-10-30 11:05 Grzegorz Kolodziejczyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).