* [PATCH] avinfo: Dump unknown codecs and unknown categories
@ 2019-01-26 10:24 Pali Rohár
2019-01-31 10:50 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 2+ messages in thread
From: Pali Rohár @ 2019-01-26 10:24 UTC (permalink / raw)
To: linux-bluetooth
---
tools/avinfo.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/tools/avinfo.c b/tools/avinfo.c
index a3298e8c8..42f539f43 100644
--- a/tools/avinfo.c
+++ b/tools/avinfo.c
@@ -648,6 +648,8 @@ static void print_media_codec(
struct avdtp_media_codec_capability *cap,
uint8_t size)
{
+ int i;
+
if (size < sizeof(*cap)) {
printf("\tMedia Codec: Unknown (broken)\n");
return;
@@ -668,6 +670,10 @@ static void print_media_codec(
break;
default:
printf("\tMedia Codec: Unknown\n");
+ printf("\t\tCodec Data:");
+ for (i = 0; i < size - 2; ++i)
+ printf(" 0x%.02x", ((unsigned char *)cap->data)[i]);
+ printf("\n");
}
}
@@ -699,6 +705,7 @@ static void print_content_protection(
static void print_caps(void *data, int size)
{
int processed;
+ int i;
for (processed = 0; processed + 2 < size;) {
struct avdtp_service_capability *cap;
@@ -715,9 +722,14 @@ static void print_caps(void *data, int size)
case AVDTP_REPORTING:
case AVDTP_RECOVERY:
case AVDTP_MULTIPLEXING:
- default:
/* FIXME: Add proper functions */
+ break;
+ default:
printf("\tUnknown category: %d\n", cap->category);
+ printf("\t\tData:");
+ for (i = 0; i < cap->length; ++i)
+ printf(" 0x%.02x", ((unsigned char *)cap->data)[i]);
+ printf("\n");
break;
case AVDTP_MEDIA_CODEC:
print_media_codec((void *) cap->data, cap->length);
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] avinfo: Dump unknown codecs and unknown categories
2019-01-26 10:24 [PATCH] avinfo: Dump unknown codecs and unknown categories Pali Rohár
@ 2019-01-31 10:50 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2019-01-31 10:50 UTC (permalink / raw)
To: Pali Rohár; +Cc: linux-bluetooth
Hi Pali,
On Sat, Jan 26, 2019 at 12:26 PM Pali Rohár <pali.rohar@gmail.com> wrote:
>
> ---
> tools/avinfo.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/tools/avinfo.c b/tools/avinfo.c
> index a3298e8c8..42f539f43 100644
> --- a/tools/avinfo.c
> +++ b/tools/avinfo.c
> @@ -648,6 +648,8 @@ static void print_media_codec(
> struct avdtp_media_codec_capability *cap,
> uint8_t size)
> {
> + int i;
> +
> if (size < sizeof(*cap)) {
> printf("\tMedia Codec: Unknown (broken)\n");
> return;
> @@ -668,6 +670,10 @@ static void print_media_codec(
> break;
> default:
> printf("\tMedia Codec: Unknown\n");
> + printf("\t\tCodec Data:");
> + for (i = 0; i < size - 2; ++i)
> + printf(" 0x%.02x", ((unsigned char *)cap->data)[i]);
> + printf("\n");
> }
> }
>
> @@ -699,6 +705,7 @@ static void print_content_protection(
> static void print_caps(void *data, int size)
> {
> int processed;
> + int i;
>
> for (processed = 0; processed + 2 < size;) {
> struct avdtp_service_capability *cap;
> @@ -715,9 +722,14 @@ static void print_caps(void *data, int size)
> case AVDTP_REPORTING:
> case AVDTP_RECOVERY:
> case AVDTP_MULTIPLEXING:
> - default:
> /* FIXME: Add proper functions */
> + break;
> + default:
> printf("\tUnknown category: %d\n", cap->category);
> + printf("\t\tData:");
> + for (i = 0; i < cap->length; ++i)
> + printf(" 0x%.02x", ((unsigned char *)cap->data)[i]);
> + printf("\n");
> break;
> case AVDTP_MEDIA_CODEC:
> print_media_codec((void *) cap->data, cap->length);
> --
> 2.11.0
Applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-31 10:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-26 10:24 [PATCH] avinfo: Dump unknown codecs and unknown categories Pali Rohár
2019-01-31 10:50 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).