diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2007-10-24 17:25:56 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2007-10-24 17:25:56 +0000 |
commit | f6e4c2b47dbf0761224232888dca66ed0bddd1c7 (patch) | |
tree | 5ef7eced739c56049c7a45888c8a5c2db352b8c2 /audio/control.c | |
parent | f5befe8ab54b797a0a5357ceddf2f05ab0ff163c (diff) |
Improve AVRCP button press decoding
Diffstat (limited to 'audio/control.c')
-rw-r--r-- | audio/control.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/audio/control.c b/audio/control.c index 5048bb17..c69c610f 100644 --- a/audio/control.c +++ b/audio/control.c @@ -57,10 +57,10 @@ #define AVCTP_RESPONSE 1 /* Packet types */ -#define AVCTP_PACKET_SINGLE 0 -#define AVCTP_PACKET_START 1 -#define AVCTP_PACKET_CONTINUE 2 -#define AVCTP_PACKET_END 3 +#define AVCTP_PACKET_SINGLE 0 +#define AVCTP_PACKET_START 1 +#define AVCTP_PACKET_CONTINUE 2 +#define AVCTP_PACKET_END 3 /* ctype entries */ #define CTYPE_CONTROL 0x0 @@ -417,27 +417,34 @@ static struct avctp *avctp_get(bdaddr_t *src, bdaddr_t *dst) static void handle_panel_passthrough(const unsigned char *operands, int operand_count) { + const char *status; + if (operand_count == 0) return; - switch (operands[0]) { + if (operands[0] & 0x80) + status = "released"; + else + status = "pressed"; + + switch (operands[0] & 0x7F) { case PLAY_OP: - debug("AVRCP: got PLAY"); + debug("AVRCP: PLAY %s", status); break; case STOP_OP: - debug("AVRCP: got STOP"); + debug("AVRCP: STOP %s", status); break; case PAUSE_OP: - debug("AVRCP: got PAUSE"); + debug("AVRCP: PAUSE %s", status); break; case NEXT_OP: - debug("AVRCP: got NEXT"); + debug("AVRCP: NEXT %s", status); break; case PREV_OP: - debug("AVRCP: got PREV"); + debug("AVRCP: PREV %s", status); break; default: - debug("AVRCP: got unknown operand 0x%02X", operands[0]); + debug("AVRCP: unknown button 0x%02X %s", operands[0] & 0x7F, status); break; } } |