1. Mar 19, 2022
    • Ismael Ferreras Morezuelas's avatar
      Bluetooth: btusb: Use quirk to skip HCI_FLT_CLEAR_ALL on fake CSR controllers · b3cf94c8
      Ismael Ferreras Morezuelas authored
      Another subset of the more recent batch of Chinese clones aren't
      specs-compliant and seem to lock up whenever they receive a
      HCI_OP_SET_EVENT_FLT with flt_type set to zero/HCI_FLT_CLEAR_ALL,
      which on Linux (until the recent HCI state-machine refactor) happened
      right at BR/EDR setup. As there are other less-straightforward ways
      of reaching those operations, this patch is still relevant.
      
      So, while all the previous efforts to wrangle the herd of fake CSRs
      seem to be paying off (and these also get detected as such) we
      still need to take care of this quirk; testers seem to agree
      that these dongles tend to work well enough afterwards.
      
      From some cursory USB packet capture on Windows it seems like
      that driver doesn't appear to use this clear-all functionality at all.
      
      This patch was tested on some really popular AliExpress-style
      dongles, in my case marked as "V5.0". Chip markings: UG8413,
      the backside of the PCB says "USB Dangel" (sic).
      
      Here is the `hciconfig -a` output; for completeness:
      
      hci0:	Type: Primary  Bus: USB
      	BD Address: 00:1A:7D:DA:7X:XX  ACL MTU: 679:8  SCO MTU: 48:16
      	UP RUNNING PSCAN ISCAN
      	Features: 0xbf 0x3e 0x4d 0xfa 0xdb 0x3d 0x7b 0xc7
      	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
      	Link policy: RSWITCH SNIFF
      	Link mode: PERIPHERAL ACCEPT
      	Name: 'CSR8510 A10.'
      	Class: 0x7c0104
      	Service Classes: Rendering, Capturing, Object Transfer, Audio, Telephony
      	Device Class: Computer, Desktop workstation
      	HCI Version: 4.0 (0x6)  Revision: 0x3120
      	LMP Version: 4.0 (0x6)  Subversion: 0x22bb
      	Manufacturer: Cambridge Silicon Radio (10)
      
      As well as the `lsusb -vv -d 0a12:0001`:
      
      ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass          224 Wireless
        bDeviceSubClass         1 Radio Frequency
        bDeviceProtocol         1 Bluetooth
        bMaxPacketSize0        64
        idVendor           0x0a12 Cambridge Silicon Radio, Ltd
        idProduct          0x0001 Bluetooth Dongle (HCI mode)
        bcdDevice           88.91
        iManufacturer           0
        iProduct                2 BT DONGLE10
        iSerial                 0
        bNumConfigurations      1
      
      Also, changed the benign dmesg print that shows up whenever the
      generic force-suspend fails from bt_dev_err to bt_dev_warn;
      it's okay and done on a best-effort basis, not a problem
      if that does not work.
      
      Also, swapped the HCI subver and LMP subver numbers for the Barrot
      in the comment, which I copied wrong the last time around.
      
      Fixes: 81cac64b ("Bluetooth: Deal with USB devices that are faking CSR vendor")
      Fixes: cde1a8a9 ("Bluetooth: btusb: Fix and detect most of the Chinese Bluetooth controllers")
      Fixes: d74e0ae7 ("Bluetooth: btusb: Fix detection of some fake CSR controllers with a bcdDevice val of 0x0134")
      Fixes: 0671c066 ("Bluetooth: btusb: Add workaround for remote-wakeup issues with Barrot 8041a02 fake CSR controllers")
      Fixes: f4292e2f ("Bluetooth: btusb: Make the CSR clone chip force-suspend workaround more generic")
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=60824
      Link: https://gist.github.com/nevack/6b36b82d715dc025163d9e9124840a07
      
      
      
      Cc: stable@vger.kernel.org
      Cc: Hans de Goede <hdegoede@redhat.com>
      Tested-by: default avatarGonzalo Tornaría <tornaria@cmat.edu.uy>
      Tested-by: default avatarMateus Lemos <lemonsmateus@gmail.com>
      Tested-by: default avatarIsmael Ferreras Morezuelas <swyterzone@gmail.com>
      Signed-off-by: default avatarIsmael Ferreras Morezuelas <swyterzone@gmail.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      b3cf94c8
    • Ismael Ferreras Morezuelas's avatar
      Bluetooth: hci_sync: Add a new quirk to skip HCI_FLT_CLEAR_ALL · 0eaecfb2
      Ismael Ferreras Morezuelas authored
      
      
      Some controllers have problems with being sent a command to clear
      all filtering. While the HCI code does not unconditionally
      send a clear-all anymore at BR/EDR setup (after the state machine
      refactor), there might be more ways of hitting these codepaths
      in the future as the kernel develops.
      
      Cc: stable@vger.kernel.org
      Cc: Hans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarIsmael Ferreras Morezuelas <swyterzone@gmail.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      0eaecfb2
    • Sean Wang's avatar
      Bluetooth: btmtkuart: fix the conflict between mtk and msft vendor event · 6ac034a7
      Sean Wang authored
      There is a conflict between MediaTek wmt event and msft vendor extension
      logic in the core layer since 145373cb
      
       ("Bluetooth: Add framework for
      Microsoft vendor extension") was introduced because we changed the type of
      mediatek wmt event to the type of msft vendor event in the driver.
      
      But the purpose we reported mediatek event to the core layer is for the
      diagnostic purpose with that we are able to see the full packet trace via
      monitoring socket with btmon. Thus, it is harmless we keep the original
      type of mediatek vendor event here to avoid breaking the msft extension
      function especially they can be supported by Mediatek future devices.
      
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      6ac034a7
    • Sean Wang's avatar
      Bluetooth: btmtkuart: add .set_bdaddr support · 3640e7f4
      Sean Wang authored
      
      
      add .set_bdaddr support
      
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      3640e7f4
    • Sean Wang's avatar
      Bluetooth: btmtkuart: rely on BT_MTK module · f5c3f989
      Sean Wang authored
      
      
      Rely on btmtk module to reduce duplicated code
      
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      f5c3f989
    • Takashi Iwai's avatar
      Bluetooth: btusb: Add missing Chicony device for Realtek RTL8723BE · cc68a041
      Takashi Iwai authored
      Chicony Electronics BT device with 04f2:b49f seems to be a missing
      entry for Realtek RTL8723BE.
      
      T:  Bus=02 Lev=01 Prnt=01 Port=03 Cnt=03 Dev#=  4 Spd=12   MxCh= 0
      D:  Ver= 2.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=04f2 ProdID=b49f Rev= 2.00
      S:  Manufacturer=Realtek
      S:  Product=Bluetooth Radio
      S:  SerialNumber=00e04c000001
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      
      BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1196779
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      cc68a041
    • Colin Ian King's avatar
      Bluetooth: mgmt: remove redundant assignment to variable cur_len · 0ca8794a
      Colin Ian King authored
      
      
      Variable cur_len is being ininitialized with a value in the start of
      a for-loop but this is never read, it is being re-assigned a new value
      on the first statement in the for-loop.  The initialization is redundant
      and can be removed.
      
      Cleans up clang scan build warning:
      net/bluetooth/mgmt.c:7958:14: warning: Although the value stored to 'cur_len'
      is used in the enclosing expression, the value is never actually read
      from 'cur_len' [deadcode.DeadStores]
      
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      0ca8794a
  2. Mar 18, 2022