linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btmon: Fix parsing A2DP FastStream codec configuration
@ 2019-01-13 17:23 Pali Rohár
  2019-01-17 23:04 ` Pali Rohár
  0 siblings, 1 reply; 4+ messages in thread
From: Pali Rohár @ 2019-01-13 17:23 UTC (permalink / raw)
  To: linux-bluetooth

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btmon: Fix parsing A2DP FastStream codec configuration
  2019-01-13 17:23 [PATCH] btmon: Fix parsing A2DP FastStream codec configuration Pali Rohár
@ 2019-01-17 23:04 ` Pali Rohár
  2019-01-18  8:05   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: Pali Rohár @ 2019-01-17 23:04 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

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?

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

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btmon: Fix parsing A2DP FastStream codec configuration
  2019-01-17 23:04 ` Pali Rohár
@ 2019-01-18  8:05   ` Luiz Augusto von Dentz
  2019-01-18  9:07     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2019-01-18  8:05 UTC (permalink / raw)
  To: Pali Rohár; +Cc: linux-bluetooth

Hi Pali,

On Thu, Jan 17, 2019 at 8:07 PM Pali Rohár <pali.rohar@gmail.com> wrote:
>
> 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?

Will do it today.

> > 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);
> >
>
> --
> Pali Rohár
> pali.rohar@gmail.com



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btmon: Fix parsing A2DP FastStream codec configuration
  2019-01-18  8:05   ` Luiz Augusto von Dentz
@ 2019-01-18  9:07     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2019-01-18  9:07 UTC (permalink / raw)
  To: Pali Rohár; +Cc: linux-bluetooth

Hi Pali,

On Fri, Jan 18, 2019 at 5:05 AM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Pali,
>
> On Thu, Jan 17, 2019 at 8:07 PM Pali Rohár <pali.rohar@gmail.com> wrote:
> >
> > 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?
>
> Will do it today.
>
> > > 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);
> > >
> >
> > --

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-18  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 17:23 [PATCH] btmon: Fix parsing A2DP FastStream codec configuration Pali Rohár
2019-01-17 23:04 ` Pali Rohár
2019-01-18  8:05   ` Luiz Augusto von Dentz
2019-01-18  9:07     ` 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).