[PATCH] btmon: Fix parsing A2DP FastStream codec configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

diff --git a/monitor/a2dp.c b/monitor/a2dp.c
index ffdcbb962..42fe395a1 100644
--- a/monitor/a2dp.c
+++ b/monitor/a2dp.c
@@ -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);
 
-- 
2.11.0




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux