* [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure
@ 2012-11-07 10:34 Luiz Augusto von Dentz
2012-11-07 10:34 ` [PATCH BlueZ 2/2] AVRCP: Add support for GetCapabilities PDU when acting as controller Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-11-07 10:34 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This simplify detecting which events are available depending on the role
and version of the session.
---
audio/avrcp.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/audio/avrcp.c b/audio/avrcp.c
index 3d9ecc7..ab9ffbf 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -197,6 +197,7 @@ struct avrcp {
unsigned int control_id;
unsigned int browsing_id;
+ uint16_t supported_events;
uint16_t registered_events;
uint8_t transaction;
uint8_t transaction_events[AVRCP_EVENT_LAST + 1];
@@ -858,12 +859,12 @@ static uint8_t avrcp_handle_get_capabilities(struct avrcp *session,
return AVC_CTYPE_STABLE;
case CAP_EVENTS_SUPPORTED:
- pdu->params[1] = 5;
- pdu->params[2] = AVRCP_EVENT_STATUS_CHANGED;
- pdu->params[3] = AVRCP_EVENT_TRACK_CHANGED;
- pdu->params[4] = AVRCP_EVENT_TRACK_REACHED_START;
- pdu->params[5] = AVRCP_EVENT_TRACK_REACHED_END;
- pdu->params[6] = AVRCP_EVENT_SETTINGS_CHANGED;
+ for (i = 0; i <= AVRCP_EVENT_LAST; i++) {
+ if (session->supported_events & (1 << i)) {
+ pdu->params[1]++;
+ pdu->params[pdu->params[1] + 1] = i;
+ }
+ }
pdu->params_len = htons(2 + pdu->params[1]);
return AVC_CTYPE_STABLE;
@@ -2064,6 +2065,11 @@ static void session_tg_init(struct avrcp *session)
}
session->control_handlers = tg_control_handlers;
+ session->supported_events = (1 << AVRCP_EVENT_STATUS_CHANGED) |
+ (1 << AVRCP_EVENT_TRACK_CHANGED) |
+ (1 << AVRCP_EVENT_TRACK_REACHED_START) |
+ (1 << AVRCP_EVENT_TRACK_REACHED_END) |
+ (1 << AVRCP_EVENT_SETTINGS_CHANGED);
if (session->version >= 0x0104) {
avrcp_register_notification(session,
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH BlueZ 2/2] AVRCP: Add support for GetCapabilities PDU when acting as controller
2012-11-07 10:34 [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Luiz Augusto von Dentz
@ 2012-11-07 10:34 ` Luiz Augusto von Dentz
2012-11-07 14:15 ` [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Lucas De Marchi
2012-11-07 14:35 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2012-11-07 10:34 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds GetCapabilities PDU id to controller handlers vtable so it is
able to respond it properly.
---
audio/avrcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/audio/avrcp.c b/audio/avrcp.c
index ab9ffbf..e3ce2fb 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -1412,6 +1412,8 @@ static const struct control_pdu_handler tg_control_handlers[] = {
};
static const struct control_pdu_handler ct_control_handlers[] = {
+ { AVRCP_GET_CAPABILITIES, AVC_CTYPE_STATUS,
+ avrcp_handle_get_capabilities },
{ },
};
--
1.7.11.7
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure
2012-11-07 10:34 [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Luiz Augusto von Dentz
2012-11-07 10:34 ` [PATCH BlueZ 2/2] AVRCP: Add support for GetCapabilities PDU when acting as controller Luiz Augusto von Dentz
@ 2012-11-07 14:15 ` Lucas De Marchi
2012-11-07 14:35 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Lucas De Marchi @ 2012-11-07 14:15 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
On Wed, Nov 7, 2012 at 8:34 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This simplify detecting which events are available depending on the role
> and version of the session.
> ---
> audio/avrcp.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/audio/avrcp.c b/audio/avrcp.c
> index 3d9ecc7..ab9ffbf 100644
> --- a/audio/avrcp.c
> +++ b/audio/avrcp.c
> @@ -197,6 +197,7 @@ struct avrcp {
>
> unsigned int control_id;
> unsigned int browsing_id;
> + uint16_t supported_events;
> uint16_t registered_events;
> uint8_t transaction;
> uint8_t transaction_events[AVRCP_EVENT_LAST + 1];
> @@ -858,12 +859,12 @@ static uint8_t avrcp_handle_get_capabilities(struct avrcp *session,
>
> return AVC_CTYPE_STABLE;
> case CAP_EVENTS_SUPPORTED:
> - pdu->params[1] = 5;
> - pdu->params[2] = AVRCP_EVENT_STATUS_CHANGED;
> - pdu->params[3] = AVRCP_EVENT_TRACK_CHANGED;
> - pdu->params[4] = AVRCP_EVENT_TRACK_REACHED_START;
> - pdu->params[5] = AVRCP_EVENT_TRACK_REACHED_END;
> - pdu->params[6] = AVRCP_EVENT_SETTINGS_CHANGED;
> + for (i = 0; i <= AVRCP_EVENT_LAST; i++) {
> + if (session->supported_events & (1 << i)) {
> + pdu->params[1]++;
> + pdu->params[pdu->params[1] + 1] = i;
> + }
> + }
>
> pdu->params_len = htons(2 + pdu->params[1]);
> return AVC_CTYPE_STABLE;
> @@ -2064,6 +2065,11 @@ static void session_tg_init(struct avrcp *session)
> }
>
> session->control_handlers = tg_control_handlers;
> + session->supported_events = (1 << AVRCP_EVENT_STATUS_CHANGED) |
> + (1 << AVRCP_EVENT_TRACK_CHANGED) |
> + (1 << AVRCP_EVENT_TRACK_REACHED_START) |
> + (1 << AVRCP_EVENT_TRACK_REACHED_END) |
> + (1 << AVRCP_EVENT_SETTINGS_CHANGED);
>
> if (session->version >= 0x0104) {
> avrcp_register_notification(session,
> --
> 1.7.11.7
>
Ack
Lucas De Marchi
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure
2012-11-07 10:34 [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Luiz Augusto von Dentz
2012-11-07 10:34 ` [PATCH BlueZ 2/2] AVRCP: Add support for GetCapabilities PDU when acting as controller Luiz Augusto von Dentz
2012-11-07 14:15 ` [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Lucas De Marchi
@ 2012-11-07 14:35 ` Johan Hedberg
2 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-11-07 14:35 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Wed, Nov 07, 2012, Luiz Augusto von Dentz wrote:
> This simplify detecting which events are available depending on the role
> and version of the session.
> ---
> audio/avrcp.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-07 14:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-07 10:34 [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Luiz Augusto von Dentz
2012-11-07 10:34 ` [PATCH BlueZ 2/2] AVRCP: Add support for GetCapabilities PDU when acting as controller Luiz Augusto von Dentz
2012-11-07 14:15 ` [PATCH BlueZ 1/2] AVRCP: Add supported events field to session structure Lucas De Marchi
2012-11-07 14:35 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox