Support for decoding AVRCP GetPlayStatus added in Bluetooth
monitor.
---
monitor/avctp.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index c331a66..3356cf9 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -168,6 +168,14 @@
#define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x06
#define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07
+/* play status */
+#define AVRCP_PLAY_STATUS_STOPPED 0x00
+#define AVRCP_PLAY_STATUS_PLAYING 0x01
+#define AVRCP_PLAY_STATUS_PAUSED 0x02
+#define AVRCP_PLAY_STATUS_FWD_SEEK 0x03
+#define AVRCP_PLAY_STATUS_REV_SEEK 0x04
+#define AVRCP_PLAY_STATUS_ERROR 0xFF
+
struct avctp_frame {
uint8_t hdr;
uint8_t pt;
@@ -563,6 +571,26 @@ static const char *mediattr2str(uint32_t attr)
}
}
+static const char *playstatus2str(uint8_t status)
+{
+ switch (status) {
+ case AVRCP_PLAY_STATUS_STOPPED:
+ return "STOPPED";
+ case AVRCP_PLAY_STATUS_PLAYING:
+ return "PLAYING";
+ case AVRCP_PLAY_STATUS_PAUSED:
+ return "PAUSED";
+ case AVRCP_PLAY_STATUS_FWD_SEEK:
+ return "FWD_SEEK";
+ case AVRCP_PLAY_STATUS_REV_SEEK:
+ return "REV_SEEK";
+ case AVRCP_PLAY_STATUS_ERROR:
+ return "ERROR";
+ default:
+ return "Unknown";
+ }
+}
+
static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
@@ -1071,6 +1099,38 @@ failed:
return false;
}
+static bool avrcp_get_play_status(struct avctp_frame *avctp_frame,
+ uint8_t ctype, uint8_t len,
+ uint8_t indent)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint32_t interval;
+ uint8_t status;
+
+ if (ctype <= AVC_CTYPE_GENERAL_INQUIRY)
+ return true;
+
+ if (!l2cap_frame_get_be32(frame, &interval))
+ return false;
+
+ print_field("%*cSongLength: 0x%08x (%u miliseconds)",
+ (indent - 8), ' ', interval, interval);
+
+ if (!l2cap_frame_get_be32(frame, &interval))
+ return false;
+
+ print_field("%*cSongPosition: 0x%08x (%u miliseconds)",
+ (indent - 8), ' ', interval, interval);
+
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cPlayStatus: 0x%02x (%s)", (indent - 8),
+ ' ', status, playstatus2str(status));
+
+ return true;
+}
+
struct avrcp_ctrl_pdu_data {
uint8_t pduid;
bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
@@ -1087,6 +1147,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
{ 0x16, avrcp_get_player_value_text },
{ 0x17, avrcp_displayable_charset },
{ 0x20, avrcp_get_element_attributes },
+ { 0x30, avrcp_get_play_status },
{ }
};
--
1.9.1
Hi,
On Thu, Sep 25, 2014 at 1:18 PM, Vikrampal Yadav <[email protected]> wrote:
> Support for decoding AVRCP GetPlayStatus added in Bluetooth
> monitor.
> ---
> monitor/avctp.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 61 insertions(+)
>
> diff --git a/monitor/avctp.c b/monitor/avctp.c
> index c331a66..3356cf9 100644
> --- a/monitor/avctp.c
> +++ b/monitor/avctp.c
> @@ -168,6 +168,14 @@
> #define AVRCP_MEDIA_ATTRIBUTE_GENRE 0x06
> #define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07
>
> +/* play status */
> +#define AVRCP_PLAY_STATUS_STOPPED 0x00
> +#define AVRCP_PLAY_STATUS_PLAYING 0x01
> +#define AVRCP_PLAY_STATUS_PAUSED 0x02
> +#define AVRCP_PLAY_STATUS_FWD_SEEK 0x03
> +#define AVRCP_PLAY_STATUS_REV_SEEK 0x04
> +#define AVRCP_PLAY_STATUS_ERROR 0xFF
> +
> struct avctp_frame {
> uint8_t hdr;
> uint8_t pt;
> @@ -563,6 +571,26 @@ static const char *mediattr2str(uint32_t attr)
> }
> }
>
> +static const char *playstatus2str(uint8_t status)
> +{
> + switch (status) {
> + case AVRCP_PLAY_STATUS_STOPPED:
> + return "STOPPED";
> + case AVRCP_PLAY_STATUS_PLAYING:
> + return "PLAYING";
> + case AVRCP_PLAY_STATUS_PAUSED:
> + return "PAUSED";
> + case AVRCP_PLAY_STATUS_FWD_SEEK:
> + return "FWD_SEEK";
> + case AVRCP_PLAY_STATUS_REV_SEEK:
> + return "REV_SEEK";
> + case AVRCP_PLAY_STATUS_ERROR:
> + return "ERROR";
> + default:
> + return "Unknown";
> + }
> +}
> +
> static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame)
> {
> struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
> @@ -1071,6 +1099,38 @@ failed:
> return false;
> }
>
> +static bool avrcp_get_play_status(struct avctp_frame *avctp_frame,
> + uint8_t ctype, uint8_t len,
> + uint8_t indent)
> +{
> + struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
> + uint32_t interval;
> + uint8_t status;
> +
> + if (ctype <= AVC_CTYPE_GENERAL_INQUIRY)
> + return true;
> +
> + if (!l2cap_frame_get_be32(frame, &interval))
> + return false;
> +
> + print_field("%*cSongLength: 0x%08x (%u miliseconds)",
> + (indent - 8), ' ', interval, interval);
> +
> + if (!l2cap_frame_get_be32(frame, &interval))
> + return false;
> +
> + print_field("%*cSongPosition: 0x%08x (%u miliseconds)",
> + (indent - 8), ' ', interval, interval);
> +
> + if (!l2cap_frame_get_u8(frame, &status))
> + return false;
> +
> + print_field("%*cPlayStatus: 0x%02x (%s)", (indent - 8),
> + ' ', status, playstatus2str(status));
> +
> + return true;
> +}
> +
> struct avrcp_ctrl_pdu_data {
> uint8_t pduid;
> bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
> @@ -1087,6 +1147,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
> { 0x16, avrcp_get_player_value_text },
> { 0x17, avrcp_displayable_charset },
> { 0x20, avrcp_get_element_attributes },
> + { 0x30, avrcp_get_play_status },
> { }
> };
>
> --
> 1.9.1
Applied, thanks.
--
Luiz Augusto von Dentz
Support for decoding AVRCP PlayItem added in Bluetooth monitor.
---
monitor/avctp.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index bb78a11..feb61b4 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -176,6 +176,12 @@
#define AVRCP_PLAY_STATUS_REV_SEEK 0x04
#define AVRCP_PLAY_STATUS_ERROR 0xFF
+/* media scope */
+#define AVRCP_MEDIA_PLAYER_LIST 0x00
+#define AVRCP_MEDIA_PLAYER_VFS 0x01
+#define AVRCP_MEDIA_SEARCH 0x02
+#define AVRCP_MEDIA_NOW_PLAYING 0x03
+
struct avctp_frame {
uint8_t hdr;
uint8_t pt;
@@ -609,6 +615,22 @@ static const char *status2str(uint8_t status)
}
}
+static const char *scope2str(uint8_t scope)
+{
+ switch (scope) {
+ case AVRCP_MEDIA_PLAYER_LIST:
+ return "Media Player List";
+ case AVRCP_MEDIA_PLAYER_VFS:
+ return "Media Player Virtual Filesystem";
+ case AVRCP_MEDIA_SEARCH:
+ return "Search";
+ case AVRCP_MEDIA_NOW_PLAYING:
+ return "Now Playing";
+ default:
+ return "Unknown";
+ }
+}
+
static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
@@ -1336,6 +1358,47 @@ response:
return true;
}
+static bool avrcp_play_item(struct avctp_frame *avctp_frame, uint8_t ctype,
+ uint8_t len, uint8_t indent)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint64_t uid;
+ uint16_t uidcounter;
+ uint8_t scope, status;
+
+ if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+ goto response;
+
+ if (!l2cap_frame_get_u8(frame, &scope))
+ return false;
+
+ print_field("%*cScope: 0x%02x (%s)", (indent - 8), ' ',
+ scope, scope2str(scope));
+
+ if (!l2cap_frame_get_be64(frame, &uid))
+ return false;
+
+ print_field("%*cUID: 0x%16" PRIx64 " (%" PRIu64 ")", (indent - 8),
+ ' ', uid, uid);
+
+ if (!l2cap_frame_get_be16(frame, &uidcounter))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", (indent - 8), ' ',
+ uidcounter, uidcounter);
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", (indent - 8), ' ', status,
+ error2str(status));
+
+ return true;
+}
+
struct avrcp_ctrl_pdu_data {
uint8_t pduid;
bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
@@ -1356,6 +1419,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
{ 0x31, avrcp_register_notification },
{ 0x50, avrcp_set_absolute_volume },
{ 0x60, avrcp_set_addressed_player },
+ { 0x74, avrcp_play_item },
{ }
};
--
1.9.1
Support for decoding AVRCP SetAbsoluteVolume added in Bluetooth
monitor.
---
monitor/avctp.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index 1ffcb7e..98304dc 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1291,6 +1291,23 @@ response:
return true;
}
+static bool avrcp_set_absolute_volume(struct avctp_frame *avctp_frame,
+ uint8_t ctype, uint8_t len,
+ uint8_t indent)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint8_t value;
+
+ if (!l2cap_frame_get_u8(frame, &value))
+ return false;
+
+ value &= 0x7F;
+ print_field("%*cVolume: %.2f%% (%d/127)", (indent - 8),
+ ' ', value/1.27, value);
+
+ return true;
+}
+
struct avrcp_ctrl_pdu_data {
uint8_t pduid;
bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
@@ -1309,6 +1326,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
{ 0x20, avrcp_get_element_attributes },
{ 0x30, avrcp_get_play_status },
{ 0x31, avrcp_register_notification },
+ { 0x50, avrcp_set_absolute_volume },
{ }
};
--
1.9.1
Support for decoding AVRCP AddToNowPlaying added in Bluetooth
monitor.
---
monitor/avctp.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index feb61b4..9de46d1 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1399,6 +1399,48 @@ response:
return true;
}
+static bool avrcp_add_to_now_playing(struct avctp_frame *avctp_frame,
+ uint8_t ctype, uint8_t len,
+ uint8_t indent)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint64_t uid;
+ uint16_t uidcounter;
+ uint8_t scope, status;
+
+ if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+ goto response;
+
+ if (!l2cap_frame_get_u8(frame, &scope))
+ return false;
+
+ print_field("%*cScope: 0x%02x (%s)", (indent - 8), ' ',
+ scope, scope2str(scope));
+
+ if (!l2cap_frame_get_be64(frame, &uid))
+ return false;
+
+ print_field("%*cUID: 0x%16" PRIx64 " (%" PRIu64 ")", (indent - 8),
+ ' ', uid, uid);
+
+ if (!l2cap_frame_get_be16(frame, &uidcounter))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", (indent - 8), ' ',
+ uidcounter, uidcounter);
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", (indent - 8), ' ', status,
+ error2str(status));
+
+ return true;
+}
+
struct avrcp_ctrl_pdu_data {
uint8_t pduid;
bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
@@ -1420,6 +1462,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
{ 0x50, avrcp_set_absolute_volume },
{ 0x60, avrcp_set_addressed_player },
{ 0x74, avrcp_play_item },
+ { 0x90, avrcp_add_to_now_playing },
{ }
};
--
1.9.1
Support for decoding AVRCP SetAddressedPlayer added in Bluetooth
monitor.
---
monitor/avctp.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index 98304dc..bb78a11 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -1308,6 +1308,34 @@ static bool avrcp_set_absolute_volume(struct avctp_frame *avctp_frame,
return true;
}
+static bool avrcp_set_addressed_player(struct avctp_frame *avctp_frame,
+ uint8_t ctype, uint8_t len,
+ uint8_t indent)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint16_t id;
+ uint8_t status;
+
+ if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+ goto response;
+
+ if (!l2cap_frame_get_be16(frame, &id))
+ return false;
+
+ print_field("%*cPlayerID: 0x%04x (%u)", (indent - 8), ' ', id, id);
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cStatus: 0x%02x (%s)", (indent - 8), ' ',
+ status, error2str(status));
+
+ return true;
+}
+
struct avrcp_ctrl_pdu_data {
uint8_t pduid;
bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
@@ -1327,6 +1355,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
{ 0x30, avrcp_get_play_status },
{ 0x31, avrcp_register_notification },
{ 0x50, avrcp_set_absolute_volume },
+ { 0x60, avrcp_set_addressed_player },
{ }
};
--
1.9.1
Support for decoding AVRCP RegisterNotification added in Bluetooth
monitor.
---
monitor/avctp.c | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 161 insertions(+)
diff --git a/monitor/avctp.c b/monitor/avctp.c
index 3356cf9..1ffcb7e 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -591,6 +591,24 @@ static const char *playstatus2str(uint8_t status)
}
}
+static const char *status2str(uint8_t status)
+{
+ switch (status) {
+ case 0x0:
+ return "NORMAL";
+ case 0x1:
+ return "WARNING";
+ case 0x2:
+ return "CRITICAL";
+ case 0x3:
+ return "EXTERNAL";
+ case 0x4:
+ return "FULL_CHARGE";
+ default:
+ return "Reserved";
+ }
+}
+
static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame)
{
struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
@@ -1131,6 +1149,148 @@ static bool avrcp_get_play_status(struct avctp_frame *avctp_frame,
return true;
}
+static bool avrcp_register_notification(struct avctp_frame *avctp_frame,
+ uint8_t ctype, uint8_t len,
+ uint8_t indent)
+{
+ struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
+ uint8_t event, status;
+ uint16_t uid;
+ uint32_t interval;
+ uint64_t id;
+
+ if (ctype > AVC_CTYPE_GENERAL_INQUIRY)
+ goto response;
+
+ if (!l2cap_frame_get_u8(frame, &event))
+ return false;
+
+ print_field("%*cEventID: 0x%02x (%s)", (indent - 8),
+ ' ', event, event2str(event));
+
+ if (!l2cap_frame_get_be32(frame, &interval))
+ return false;
+
+ print_field("%*cInterval: 0x%08x (%u seconds)",
+ (indent - 8), ' ', interval, interval);
+
+ return true;
+
+response:
+ if (!l2cap_frame_get_u8(frame, &event))
+ return false;
+
+ print_field("%*cEventID: 0x%02x (%s)", (indent - 8),
+ ' ', event, event2str(event));
+
+ switch (event) {
+ case AVRCP_EVENT_PLAYBACK_STATUS_CHANGED:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cPlayStatus: 0x%02x (%s)", (indent - 8),
+ ' ', status, playstatus2str(status));
+ break;
+ case AVRCP_EVENT_TRACK_CHANGED:
+ if (!l2cap_frame_get_be64(frame, &id))
+ return false;
+
+ print_field("%*cIdentifier: 0x%16" PRIx64 " (%" PRIu64 ")",
+ (indent - 8), ' ', id, id);
+ break;
+ case AVRCP_EVENT_PLAYBACK_POS_CHANGED:
+ if (!l2cap_frame_get_be32(frame, &interval))
+ return false;
+
+ print_field("%*cPosition: 0x%08x (%u miliseconds)",
+ (indent - 8), ' ', interval, interval);
+ break;
+ case AVRCP_EVENT_BATT_STATUS_CHANGED:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cBatteryStatus: 0x%02x (%s)", (indent - 8),
+ ' ', status, status2str(status));
+
+ break;
+ case AVRCP_EVENT_SYSTEM_STATUS_CHANGED:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cSystemStatus: 0x%02x ", (indent - 8),
+ ' ', status);
+ switch (status) {
+ case 0x00:
+ printf("(POWER_ON)\n");
+ break;
+ case 0x01:
+ printf("(POWER_OFF)\n");
+ break;
+ case 0x02:
+ printf("(UNPLUGGED)\n");
+ break;
+ default:
+ printf("(UNKOWN)\n");
+ break;
+ }
+ break;
+ case AVRCP_EVENT_PLAYER_APPLICATION_SETTING_CHANGED:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ print_field("%*cAttributeCount: 0x%02x", (indent - 8),
+ ' ', status);
+
+ for (; status > 0; status--) {
+ uint8_t attr, value;
+
+ if (!l2cap_frame_get_u8(frame, &attr))
+ return false;
+
+ print_field("%*cAttributeID: 0x%02x (%s)",
+ (indent - 8), ' ', attr, attr2str(attr));
+
+ if (!l2cap_frame_get_u8(frame, &value))
+ return false;
+
+ print_field("%*cValueID: 0x%02x (%s)", (indent - 8),
+ ' ', value, value2str(attr, value));
+ }
+ break;
+ case AVRCP_EVENT_VOLUME_CHANGED:
+ if (!l2cap_frame_get_u8(frame, &status))
+ return false;
+
+ status &= 0x7F;
+
+ print_field("%*cVolume: %.2f%% (%d/127)", (indent - 8),
+ ' ', status/1.27, status);
+ break;
+ case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
+ if (!l2cap_frame_get_be16(frame, &uid))
+ return false;
+
+ print_field("%*cPlayerID: 0x%04x (%u)", (indent - 8),
+ ' ', uid, uid);
+
+ if (!l2cap_frame_get_be16(frame, &uid))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", (indent - 8),
+ ' ', uid, uid);
+ break;
+ case AVRCP_EVENT_UIDS_CHANGED:
+ if (!l2cap_frame_get_be16(frame, &uid))
+ return false;
+
+ print_field("%*cUIDCounter: 0x%04x (%u)", (indent - 8),
+ ' ', uid, uid);
+ break;
+ }
+
+ return true;
+}
+
struct avrcp_ctrl_pdu_data {
uint8_t pduid;
bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
@@ -1148,6 +1308,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
{ 0x17, avrcp_displayable_charset },
{ 0x20, avrcp_get_element_attributes },
{ 0x30, avrcp_get_play_status },
+ { 0x31, avrcp_register_notification },
{ }
};
--
1.9.1
Hi Vikram,
On Wed, Sep 24, 2014 at 2:40 PM, Vikrampal Yadav <[email protected]> wrote:
> Support for decoding AVRCP GetPlayStatus added in Bluetooth
> monitor.
> ---
> monitor/avctp.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 61 insertions(+)
>
> diff --git a/monitor/avctp.c b/monitor/avctp.c
> index f366b87..352a744 100644
> --- a/monitor/avctp.c
> +++ b/monitor/avctp.c
> @@ -158,6 +158,14 @@
> #define AVRCP_ATTRIBUTE_SHUFFLE 0x03
> #define AVRCP_ATTRIBUTE_SCAN 0x04
>
> +/* play status */
> +#define AVRCP_PLAY_STATUS_STOPPED 0x00
> +#define AVRCP_PLAY_STATUS_PLAYING 0x01
> +#define AVRCP_PLAY_STATUS_PAUSED 0x02
> +#define AVRCP_PLAY_STATUS_FWD_SEEK 0x03
> +#define AVRCP_PLAY_STATUS_REV_SEEK 0x04
> +#define AVRCP_PLAY_STATUS_ERROR 0xFF
> +
> struct avctp_frame {
> uint8_t hdr;
> uint8_t pt;
> @@ -524,6 +532,26 @@ static const char *charset2str(uint16_t charset)
> }
> }
>
> +static const char *playstatus2str(uint8_t status)
> +{
> + switch (status) {
> + case AVRCP_PLAY_STATUS_STOPPED:
> + return "STOPPED";
> + case AVRCP_PLAY_STATUS_PLAYING:
> + return "PLAYING";
> + case AVRCP_PLAY_STATUS_PAUSED:
> + return "PAUSED";
> + case AVRCP_PLAY_STATUS_FWD_SEEK:
> + return "FWD_SEEK";
> + case AVRCP_PLAY_STATUS_REV_SEEK:
> + return "REV_SEEK";
> + case AVRCP_PLAY_STATUS_ERROR:
> + return "ERROR";
> + default:
> + return "Unknown";
> + }
> +}
> +
> static bool avrcp_passthrough_packet(struct avctp_frame *avctp_frame)
> {
> struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
> @@ -905,6 +933,38 @@ static bool avrcp_displayable_charset(struct avctp_frame *avctp_frame,
> return true;
> }
>
> +static bool avrcp_get_play_status(struct avctp_frame *avctp_frame,
> + uint8_t ctype, uint8_t len,
> + uint8_t indent)
> +{
> + struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
> + uint32_t interval;
> + uint8_t status;
> +
> + if (ctype <= AVC_CTYPE_GENERAL_INQUIRY)
> + return true;
> +
> + if (!l2cap_frame_get_be32(frame, &interval))
> + return false;
> +
> + print_field("%*cSongLength: 0x%08x (%u miliseconds)",
> + (indent - 8), ' ', interval, interval);
> +
> + if (!l2cap_frame_get_be32(frame, &interval))
> + return false;
> +
> + print_field("%*cSongPosition: 0x%08x (%u miliseconds)",
> + (indent - 8), ' ', interval, interval);
> +
> + if (!l2cap_frame_get_u8(frame, &status))
> + return false;
> +
> + print_field("%*cPlayStatus: 0x%02x (%s)", (indent - 8),
> + ' ', status, playstatus2str(status));
> +
> + return true;
> +}
> +
> struct avrcp_ctrl_pdu_data {
> uint8_t pduid;
> bool (*func) (struct avctp_frame *avctp_frame, uint8_t ctype,
> @@ -920,6 +980,7 @@ static const struct avrcp_ctrl_pdu_data avrcp_ctrl_pdu_table[] = {
> { 0x15, avrcp_get_player_attribute_text },
> { 0x16, avrcp_get_player_value_text },
> { 0x17, avrcp_displayable_charset },
> + { 0x30, avrcp_get_play_status },
> { }
> };
>
> --
> 1.9.1
This one doesn't apply, perhaps you need to rebase.
--
Luiz Augusto von Dentz