From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/6] AVRCP: Avoid repeating command due to changed event
Date: Thu, 31 Jan 2013 21:58:33 -0600 [thread overview]
Message-ID: <1359691117-13847-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1359691117-13847-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Currently we are repeating the same command twice for notification, first
for changed and then latter for interim response.
To avoid this the code now just do it for interim responses, changed
responses just trigger another registration.
---
profiles/audio/avrcp.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 728ba91..0a173bc 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1877,6 +1877,12 @@ static gboolean avrcp_handle_event(struct avctp *conn,
event = pdu->params[0];
+ if (code == AVC_CTYPE_CHANGED) {
+ session->registered_events ^= (1 << event);
+ avrcp_register_notification(session, event);
+ return FALSE;
+ }
+
switch (event) {
case AVRCP_EVENT_VOLUME_CHANGED:
value = pdu->params[1] & 0x7F;
@@ -1900,12 +1906,8 @@ static gboolean avrcp_handle_event(struct avctp *conn,
break;
case AVRCP_EVENT_TRACK_CHANGED:
- mp = player->user_data;
-
avrcp_get_element_attributes(session);
-
- if (code == AVC_CTYPE_CHANGED)
- avrcp_get_play_status(session);
+ avrcp_get_play_status(session);
break;
@@ -1932,12 +1934,6 @@ static gboolean avrcp_handle_event(struct avctp *conn,
break;
}
- if (code == AVC_CTYPE_CHANGED) {
- session->registered_events ^= (1 << event);
- avrcp_register_notification(session, event);
- return FALSE;
- }
-
session->registered_events |= (1 << event);
return TRUE;
--
1.8.1
next prev parent reply other threads:[~2013-02-01 3:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 3:58 [PATCH BlueZ 1/6] media-api: Add org.bluez.MediaFolder1 Luiz Augusto von Dentz
2013-02-01 3:58 ` Luiz Augusto von Dentz [this message]
2013-02-01 3:58 ` [PATCH BlueZ 3/6] AVRCP: Register to addressed player changed event if supported Luiz Augusto von Dentz
2013-02-01 3:58 ` [PATCH BlueZ 4/6] AVRCP: Get player list " Luiz Augusto von Dentz
2013-02-01 3:58 ` [PATCH BlueZ 5/6] AVRCP: Split event handing to its own functions Luiz Augusto von Dentz
2013-02-01 3:58 ` [PATCH BlueZ 6/6] AVRCP: Set addressed player as browsed player Luiz Augusto von Dentz
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=1359691117-13847-2-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