btmon: Fix parsing A2DP FastStream codec configuration
PATCH 1/1 btmon: Fix parsing A2DP FastStream codec configuration
This codec is bi-directional, therefore both sink and source directions may be present in configuration at same time.
Some Creative headsets send more frequency bits in configuration and when both 41kHz and 48kHz are present then headset expects 48kHz. So adjust FastStream frequency table as find_value_bit() takes first matched bit.
--- monitor/a2dp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
monitor/a2dp.c +6 -4
@@ -201,8 +201,10 @@ static const struct bit_desc faststream_direction_table[] = { };static const struct bit_desc faststream_sink_frequency_table[] = { - {1 ,"44100" }, +/* in config buffer, there may be more frequency bits +* and 48kHz takes precedence over 41kHz */ {0 ,"48000" }, + {1 ,"44100" }, { } };
@@ -746,9 +748,9 @@ static bool codec_vendor_faststream_cfg(uint8_t losc, struct l2cap_frame *frame)l2cap_frame_get_u8 (frame, &cap); -print_field ("%*cDirection: %s (0x%02x)" ,BASE_INDENT +2 ,' ' , -find_value_bit (cap, faststream_direction_table), - cap); +/* FastStream codec is bi-directional */ +print_field ("%*cDirection: 0x%02x" ,BASE_INDENT +2 ,' ' , cap); +print_value_bits (BASE_INDENT +2 , cap, faststream_direction_table);l2cap_frame_get_u8 (frame, &cap);
Signature · 1 line
2.11.0
Quoted 9 lines · On Sunday 13 January 2019 18:23:20 Pali Rohár wrote:
This codec is bi-directional, therefore both sink and source directions may be present in configuration at same time.
Some Creative headsets send more frequency bits in configuration and when both 41kHz and 48kHz are present then headset expects 48kHz. So adjust FastStream frequency table as
find_value_bit()takes first matched bit.--- monitor/a2dp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Hello, can somebody review this bluez patch?
Quoted 29 lines
monitor/a2dp.c +6
-4@@ -201,8 +201,10 @@ static const struct bit_desc faststream_direction_table[] = { };static const struct bit_desc faststream_sink_frequency_table[] = { - {1 ,"44100" }, +/* in config buffer, there may be more frequency bits +* and 48kHz takes precedence over 41kHz */ {0 ,"48000" }, + {1 ,"44100" }, { } };@@ -746,9 +748,9 @@ static bool codec_vendor_faststream_cfg(uint8_t losc, struct l2cap_frame *frame)l2cap_frame_get_u8 (frame, &cap); -print_field ("%*cDirection: %s (0x%02x)" ,BASE_INDENT +2 ,' ' , -find_value_bit (cap, faststream_direction_table), - cap); +/* FastStream codec is bi-directional */ +print_field ("%*cDirection: 0x%02x" ,BASE_INDENT +2 ,' ' , cap); +print_value_bits (BASE_INDENT +2 , cap, faststream_direction_table);l2cap_frame_get_u8 (frame, &cap);
Signature · 2 lines
Pali Rohár [email protected]
Luiz Augusto von Dentz
maintainerHi Pali,
Quoted 5 lines · Pali Rohár
Quoted 3 lines · On Sunday 13 January 2019 18:23:20 Pali Rohár wrote:
This codec is bi-directional, therefore both sink and source directions may be present in configuration at same time.
Quoted 8 lines
Quoted 6 lines
Some Creative headsets send more frequency bits in configuration and when both 41kHz and 48kHz are present then headset expects 48kHz. So adjust FastStream frequency table as
find_value_bit()takes first matched bit.--- monitor/a2dp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)Hello, can somebody review this bluez patch?
Will do it today.
Quoted 33 lines
Quoted 19 lines
monitor/a2dp.c +3
-1@@ -201,8 +201,10 @@ static const struct bit_desc faststream_direction_table[] = { };static const struct bit_desc faststream_sink_frequency_table[] = { - {1 ,"44100" }, +/* in config buffer, there may be more frequency bits +* and 48kHz takes precedence over 41kHz */ {0 ,"48000" }, + {1 ,"44100" }, { } };@@ -746,9 +748,9 @@ static bool codec_vendor_faststream_cfg(uint8_t losc, struct l2cap_frame *frame)l2cap_frame_get_u8 (frame, &cap);monitor/a2dp.c static bool codec_vendor_faststream_cfg(uint8_t losc, struct l2cap_frame *frame) · line 756
Quoted 10 lines
monitor/a2dp.c +3
-3-print_field ("%*cDirection: %s (0x%02x)" ,BASE_INDENT +2 ,' ' , -find_value_bit (cap, faststream_direction_table), - cap); +/* FastStream codec is bi-directional */ +print_field ("%*cDirection: 0x%02x" ,BASE_INDENT +2 ,' ' , cap); +print_value_bits (BASE_INDENT +2 , cap, faststream_direction_table);l2cap_frame_get_u8 (frame, &cap);--
Pali Rohár
[email protected]
Signature · 1 line
Luiz Augusto von Dentz
Hi Pali,
Quoted 16 lines · Luiz Augusto von Dentz
Hi Pali,
Quoted 12 lines · Pali Rohár
Quoted 9 lines · On Sunday 13 January 2019 18:23:20 Pali Rohár wrote:
This codec is bi-directional, therefore both sink and source directions may be present in configuration at same time.
Some Creative headsets send more frequency bits in configuration and when both 41kHz and 48kHz are present then headset expects 48kHz. So adjust FastStream frequency table as
find_value_bit()takes first matched bit.--- monitor/a2dp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Quoted 35 lines
Quoted 1 line
Hello, can somebody review this bluez patch?
Will do it today.
Quoted 31 lines
Quoted 19 lines
monitor/a2dp.c +3
-1@@ -201,8 +201,10 @@ static const struct bit_desc faststream_direction_table[] = { };static const struct bit_desc faststream_sink_frequency_table[] = { - {1 ,"44100" }, +/* in config buffer, there may be more frequency bits +* and 48kHz takes precedence over 41kHz */ {0 ,"48000" }, + {1 ,"44100" }, { } };@@ -746,9 +748,9 @@ static bool codec_vendor_faststream_cfg(uint8_t losc, struct l2cap_frame *frame)l2cap_frame_get_u8 (frame, &cap);monitor/a2dp.c static bool codec_vendor_faststream_cfg(uint8_t losc, struct l2cap_frame *frame) · line 756
Quoted 10 lines
monitor/a2dp.c +3
-3-print_field ("%*cDirection: %s (0x%02x)" ,BASE_INDENT +2 ,' ' , -find_value_bit (cap, faststream_direction_table), - cap); +/* FastStream codec is bi-directional */ +print_field ("%*cDirection: 0x%02x" ,BASE_INDENT +2 ,' ' , cap); +print_value_bits (BASE_INDENT +2 , cap, faststream_direction_table);l2cap_frame_get_u8 (frame, &cap);--
Applied, thanks.
Signature · 1 line
Luiz Augusto von Dentz