Linux bluetooth development
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: linux-bluetooth <linux-bluetooth@vger.kernel.org>
Subject: [PATCH] Improve input server connect log messages
Date: Sat, 2 Jul 2011 13:48:09 -0400	[thread overview]
Message-ID: <1309628889.22449.15.camel@THOR> (raw)

Added error log message for connection refusals and added
remote device BDADDR to existing debug messages.
---
 input/server.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/input/server.c b/input/server.c
index 7fd00f2..cea08d1 100644
--- a/input/server.c
+++ b/input/server.c
@@ -62,6 +62,7 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
 {
 	uint16_t psm;
 	bdaddr_t src, dst;
+	char address[18];
 	GError *gerr = NULL;
 	int ret;
 
@@ -82,12 +83,15 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
 		return;
 	}
 
-	DBG("Incoming connection on PSM %d", psm);
+	ba2str(&dst, address);
+	DBG("Incoming connection from %s on PSM %d", address, psm);
 
 	ret = input_device_set_channel(&src, &dst, psm, chan);
 	if (ret == 0)
 		return;
 
+	error("Refusing input device connect: %s (%d)", strerror(-ret), -ret);
+
 	/* Send unplug virtual cable to unknown devices */
 	if (ret == -ENOENT && psm == L2CAP_PSM_HIDP_CTRL) {
 		unsigned char unplug = 0x15;
@@ -157,7 +161,11 @@ static void confirm_event_cb(GIOChannel *chan, gpointer user_data)
 	}
 
 	if (server->confirm) {
-		error("Refusing connection: setup in progress");
+		char address[18];
+
+		ba2str(&dst, address);
+		error("Refusing connection from %s: setup in progress",
+								address);
 		goto drop;
 	}
 
-- 
1.7.4.1


             reply	other threads:[~2011-07-02 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-02 17:48 Peter Hurley [this message]
2011-07-03 11:42 ` [PATCH] Improve input server connect log messages Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309628889.22449.15.camel@THOR \
    --to=peter@hurleysoftware.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox