mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2025-01-12 22:43:22 +08:00
tools/hcidump: Decode aptX codec capabilities
This commit is contained in:
parent
fee302da25
commit
a238e3b108
@ -150,6 +150,13 @@ static char *codec2str(uint8_t type, uint8_t codec)
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
static char *vndcodec2str(uint32_t vendor, uint16_t vndcodec)
|
||||
{
|
||||
if (vendor == 0x0000004f && vndcodec == 0x0001)
|
||||
return "aptX";
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
static char *cat2str(uint8_t cat)
|
||||
{
|
||||
switch (cat) {
|
||||
@ -213,13 +220,23 @@ static void capabilities(int level, struct frame *frm)
|
||||
|
||||
if (cat == 7) {
|
||||
uint8_t type, codec;
|
||||
uint16_t tmp, freq;
|
||||
uint32_t bitrate;
|
||||
uint16_t tmp, freq, vndcodec = 0;
|
||||
uint32_t bitrate, vendor = 0;
|
||||
|
||||
type = get_u8(frm);
|
||||
codec = get_u8(frm);
|
||||
|
||||
printf("%s - %s\n", cat2str(cat), codec2str(type, codec));
|
||||
if (codec == 255) {
|
||||
vendor = btohl(htonl(get_u32(frm)));
|
||||
vndcodec = btohs(htons(get_u16(frm)));
|
||||
|
||||
printf("%s - %s (%s)\n", cat2str(cat),
|
||||
codec2str(type, codec),
|
||||
vndcodec2str(vendor, vndcodec));
|
||||
} else {
|
||||
printf("%s - %s\n", cat2str(cat),
|
||||
codec2str(type, codec));
|
||||
}
|
||||
|
||||
switch (codec) {
|
||||
case 0:
|
||||
@ -324,6 +341,33 @@ static void capabilities(int level, struct frame *frm)
|
||||
printf("%ubps ", bitrate);
|
||||
printf("%s\n", tmp & 0x80 ? "VBR" : "");
|
||||
break;
|
||||
case 255:
|
||||
if (vendor == 0x0000004f &&
|
||||
vndcodec == 0x0001) {
|
||||
tmp = get_u8(frm);
|
||||
p_indent(level + 1, frm);
|
||||
if (tmp & 0x80)
|
||||
printf("16kHz ");
|
||||
if (tmp & 0x40)
|
||||
printf("32kHz ");
|
||||
if (tmp & 0x20)
|
||||
printf("44.1kHz ");
|
||||
if (tmp & 0x10)
|
||||
printf("48kHz ");
|
||||
printf("\n");
|
||||
p_indent(level + 1, frm);
|
||||
if (tmp & 0x02)
|
||||
printf("Stereo ");
|
||||
if (tmp & 0x01)
|
||||
printf("Mono ");
|
||||
printf("\n");
|
||||
break;
|
||||
} else {
|
||||
hex_dump(level + 1, frm, len - 8);
|
||||
frm->ptr += (len - 8);
|
||||
frm->len -= (len - 8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
hex_dump(level + 1, frm, len - 2);
|
||||
frm->ptr += (len - 2);
|
||||
|
Loading…
Reference in New Issue
Block a user