Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] Fix not being able to register pdu handlers
Date: Wed,  5 Oct 2011 17:24:30 +0300	[thread overview]
Message-ID: <1317824670-7671-1-git-send-email-luiz.dentz@gmail.com> (raw)

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This happens when removing and adding again an adapter
---
 audio/avctp.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/audio/avctp.c b/audio/avctp.c
index b8cb36e..89ef70c 100644
--- a/audio/avctp.c
+++ b/audio/avctp.c
@@ -463,6 +463,7 @@ static gboolean session_cb(GIOChannel *chan, GIOCondition cond,
 
 	handler = find_handler(handlers, avc->opcode);
 	if (!handler) {
+		DBG("handler not found for 0x%02x", avc->opcode);
 		avc->code = AVC_CTYPE_REJECTED;
 		goto done;
 	}
@@ -824,14 +825,20 @@ void avctp_unregister(const bdaddr_t *src)
 	if (servers)
 		return;
 
-	if (passthrough_id)
+	if (passthrough_id) {
 		avctp_unregister_pdu_handler(passthrough_id);
+		passthrough_id = 0;
+	}
 
-	if (unit_id)
+	if (unit_id) {
 		avctp_unregister_pdu_handler(unit_id);
+		passthrough_id = 0;
+	}
 
-	if (subunit_id)
-		avctp_unregister_pdu_handler(unit_id);
+	if (subunit_id) {
+		avctp_unregister_pdu_handler(subunit_id);
+		subunit_id = 0;
+	}
 }
 
 int avctp_send_passthrough(struct avctp *session, uint8_t op)
-- 
1.7.6.4


             reply	other threads:[~2011-10-05 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 14:24 Luiz Augusto von Dentz [this message]
2011-10-05 14:10 ` [PATCH BlueZ] Fix not being able to register pdu handlers 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=1317824670-7671-1-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.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