From: Vikrampal Yadav <vikram.pal@samsung.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, d.kasatkin@samsung.com,
vikram.pal@samsung.com, cpgs@samsung.com
Subject: [PATCH] Monitor: Add AVRCP PASS THROUGH command support
Date: Tue, 07 Oct 2014 15:35:51 +0530 [thread overview]
Message-ID: <1412676351-29503-1-git-send-email-vikram.pal@samsung.com> (raw)
Support for decoding AVRCP PASS THROUGH command added in Bluetooth
monitor.
---
monitor/avctp.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 61 insertions(+), 2 deletions(-)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index 9de46d1..a4e34c5 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -182,6 +182,20 @@
#define AVRCP_MEDIA_SEARCH 0x02
#define AVRCP_MEDIA_NOW_PLAYING 0x03
+/* operands in passthrough commands */
+#define AVC_PANEL_VOLUME_UP 0x41
+#define AVC_PANEL_VOLUME_DOWN 0x42
+#define AVC_PANEL_MUTE 0x43
+#define AVC_PANEL_PLAY 0x44
+#define AVC_PANEL_STOP 0x45
+#define AVC_PANEL_PAUSE 0x46
+#define AVC_PANEL_RECORD 0x47
+#define AVC_PANEL_REWIND 0x48
+#define AVC_PANEL_FAST_FORWARD 0x49
+#define AVC_PANEL_EJECT 0x4a
+#define AVC_PANEL_FORWARD 0x4b
+#define AVC_PANEL_BACKWARD 0x4c
+
struct avctp_frame {
uint8_t hdr;
uint8_t pt;
@@ -631,9 +645,54 @@ static const char *scope2str(uint8_t scope)
}
}
-static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame)
+static char *op2str(uint8_t op)
+{
+ switch (op & 0x7f) {
+ case AVC_PANEL_VOLUME_UP:
+ return "VOLUME UP";
+ case AVC_PANEL_VOLUME_DOWN:
+ return "VOLUME DOWN";
+ case AVC_PANEL_MUTE:
+ return "MUTE";
+ case AVC_PANEL_PLAY:
+ return "PLAY";
+ case AVC_PANEL_STOP:
+ return "STOP";
+ case AVC_PANEL_PAUSE:
+ return "PAUSE";
+ case AVC_PANEL_RECORD:
+ return "RECORD";
+ case AVC_PANEL_REWIND:
+ return "REWIND";
+ case AVC_PANEL_FAST_FORWARD:
+ return "FAST FORWARD";
+ case AVC_PANEL_EJECT:
+ return "EJECT";
+ case AVC_PANEL_FORWARD:
+ return "FORWARD";
+ case AVC_PANEL_BACKWARD:
+ return "BACKWARD";
+ default:
+ return "UNKNOWN";
+ }
+}
+
+static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame,
+ uint8_t indent)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint8_t op, len;
+
+ if (!l2cap_frame_get_u8(frame, &op))
+ return false;
+
+ print_field("%*cOperation: 0x%02x (%s %s)", (indent - 2), ' ', op,
+ op2str(op), op & 0x80 ? "Released" : "Pressed");
+
+ if (!l2cap_frame_get_u8(frame, &len))
+ return false;
+
+ print_field("%*cLength: 0x%02x", (indent - 2), ' ', len);
packet_hexdump(frame->data, frame->size);
return true;
@@ -1555,7 +1614,7 @@ static bool avrcp_control_packet(struct avctp_frame *avctp_frame)
switch (opcode) {
case 0x7c:
- return avrcp_passthrough_packet(avctp_frame);
+ return avrcp_passthrough_packet(avctp_frame, 10);
case 0x00:
if (!l2cap_frame_get_u8(frame, &company[0]) ||
!l2cap_frame_get_u8(frame, &company[1]) ||
--
1.9.1
next reply other threads:[~2014-10-07 10:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-07 10:05 Vikrampal Yadav [this message]
2014-10-08 14:24 ` [PATCH] Monitor: Add AVRCP PASS THROUGH command support 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=1412676351-29503-1-git-send-email-vikram.pal@samsung.com \
--to=vikram.pal@samsung.com \
--cc=cpgs@samsung.com \
--cc=d.kasatkin@samsung.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
/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