From b82332a07a946d33bf91f27be8034eb9f72ef392 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Sat, 1 Mar 2014 16:09:38 +0200 Subject: [PATCH] android/avrcp-lib: Add pressed status to passthrough handler callback This adds pressed status to passthrough handler callback which is required by Android HAL for certain keys such as fast forward and rewind. --- android/avrcp-lib.c | 6 +----- android/avrcp-lib.h | 2 +- unit/test-avrcp.c | 10 ++++++---- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c index 4fd86f63f..6e714eff1 100644 --- a/android/avrcp-lib.c +++ b/android/avrcp-lib.c @@ -215,11 +215,7 @@ static bool handle_passthrough_pdu(struct avctp *conn, uint8_t op, if (handler->func == NULL) return false; - /* Do not trigger handler on release */ - if (!pressed) - return true; - - return handler->func(session, session->passthrough_data); + return handler->func(session, pressed, session->passthrough_data); } static void disconnect_cb(void *data) diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h index 430f54508..3df58975d 100644 --- a/android/avrcp-lib.h +++ b/android/avrcp-lib.h @@ -86,7 +86,7 @@ struct avrcp_control_handler { struct avrcp_passthrough_handler { uint8_t op; - bool (*func) (struct avrcp *session, void *user_data); + bool (*func) (struct avrcp *session, bool pressed, void *user_data); }; typedef void (*avrcp_destroy_cb_t) (void *user_data); diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c index ac267bbf9..0294973a0 100644 --- a/unit/test-avrcp.c +++ b/unit/test-avrcp.c @@ -257,28 +257,30 @@ static void execute_context(struct context *context) destroy_context(context); } -static bool handle_play(struct avrcp *session, void *user_data) +static bool handle_play(struct avrcp *session, bool pressed, void *user_data) { DBG(""); return true; } -static bool handle_volume_up(struct avrcp *session, void *user_data) +static bool handle_volume_up(struct avrcp *session, bool pressed, + void *user_data) { DBG(""); return true; } -static bool handle_channel_up(struct avrcp *session, void *user_data) +static bool handle_channel_up(struct avrcp *session, bool pressed, + void *user_data) { DBG(""); return true; } -static bool handle_select(struct avrcp *session, void *user_data) +static bool handle_select(struct avrcp *session, bool pressed, void *user_data) { DBG(""); -- 2.47.3