Message ID | 20220222212227.24515-1-luiz.dentz@gmail.com |
---|---|
State | New |
Headers | show |
Series | [RFC] Bluetooth: SCO: Fix codec when using HCI_Enhanced_Setup_Synchronous_Connection | expand |
Hi Luiz, > This makes sure BT_CODEC_MSBC is used by default if socket user attempt > to use BT_VOICE_TRANSPARENT. > > Fixes: b2af264ad3af ("Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command") > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > --- > net/bluetooth/sco.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c > index 8eabf41b2993..b35c772efc7e 100644 > --- a/net/bluetooth/sco.c > +++ b/net/bluetooth/sco.c > @@ -879,15 +879,9 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, > } > > sco_pi(sk)->setting = voice.setting; > - hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src, > - BDADDR_BREDR); > - if (!hdev) { > - err = -EBADFD; > - break; > - } > - if (enhanced_sco_capable(hdev) && > - voice.setting == BT_VOICE_TRANSPARENT) > - sco_pi(sk)->codec.id = BT_CODEC_TRANSPARENT; > + if (voice.setting == BT_VOICE_TRANSPARENT) > + sco_pi(sk)->codec.id = BT_CODEC_MSBC; > + > hci_dev_put(hdev); > break; why are you removing the rest and especially the eSCO check? Regards Marcel
Hi Pauli, > According to user reports, how HCI_Enhanced_Setup_Synchronous_Connection > is currently used to establish MSBC connections results to broken audio > on some adapters (QCA6174, mt7921e). > > Revert to previous behavior of using HCI_Setup_Synchronous_Connection, > unless the user has explicitly set BT_CODEC sockopt. Since bt_codec > contents come from Core specification, use a separate flag for the > setting. > > Fixes: b2af264ad3af ("Bluetooth: Add support for HCI_Enhanced_Setup_Synchronous_Connection command") > Link: https://bugzilla.kernel.org/show_bug.cgi?id=215576 > Signed-off-by: Pauli Virtanen <pav@iki.fi> > --- > > Notes: > Maybe we want to use the ESCO connect setup only when userspace has > requested the codec offload support. I don't have any of the broken > hardware myself, so this is not tested on them. > > Alternatively, there should be some driver quirk to indicate the > enhanced sco connection setup is not broken. yes, these needs to be marked as my hardware is broken.
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 8eabf41b2993..b35c772efc7e 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -879,15 +879,9 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, } sco_pi(sk)->setting = voice.setting; - hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src, - BDADDR_BREDR); - if (!hdev) { - err = -EBADFD; - break; - } - if (enhanced_sco_capable(hdev) && - voice.setting == BT_VOICE_TRANSPARENT) - sco_pi(sk)->codec.id = BT_CODEC_TRANSPARENT; + if (voice.setting == BT_VOICE_TRANSPARENT) + sco_pi(sk)->codec.id = BT_CODEC_MSBC; + hci_dev_put(hdev); break;