2023-10-01 07:40:42

by Erik Dobák

[permalink] [raw]
Subject: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

Hello!

I bought a new laptop fujitsu life book and everything is going fine
on artix just the bt makes trouble:

/var/log/error.log
Sep 30 18:43:48 nexus bluetoothd[2266]:
src/adapter.c:reset_adv_monito
rs_complete() Failed to reset Adv
Monitors: Failed (0x03)
Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to clear UUIDs: Failed (0x03)
Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to add UUID: Failed (0x03)
Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to add UUID: Failed (0x03)

i searched a bit the webs and found a new commit at kernel org that
does do the trouble:
https://bugs.archlinux.org/task/78980

follow the linkeys inside the commits there or read this one:

---------------before------------------------------------
/* interface numbers are hardcoded in the spec */
if (intf->cur_altsetting->desc.bInterfaceNumber != 0) {
if (!(id->driver_info & BTUSB_IFNUM_2))
return -ENODEV;
if (intf->cur_altsetting->desc.bInterfaceNumber != 2)
return -ENODEV;
}
-----------after----------------------------------------------------
if ((id->driver_info & BTUSB_IFNUM_2) &&
(intf->cur_altsetting->desc.bInterfaceNumber != 0) &&
(intf->cur_altsetting->desc.bInterfaceNumber != 2))
return -ENODEV;
--------------------------------------------------------

the dude just hooked up 3 conditions in a row with && where before it
was 2 conditions in 1 condition. + the comment was removed.


please reconsider this commit.

Yours

E


2023-10-02 23:47:23

by Bagas Sanjaya

[permalink] [raw]
Subject: Re: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

On Sun, Oct 01, 2023 at 07:47:54AM +0200, Erik Dobák wrote:
> Hello!
>
> I bought a new laptop fujitsu life book and everything is going fine
> on artix just the bt makes trouble:
>
> /var/log/error.log
> Sep 30 18:43:48 nexus bluetoothd[2266]:
> src/adapter.c:reset_adv_monitors_complete() Failed to reset Adv
> Monitors: Failed (0x03)
> Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to clear UUIDs: Failed (0x03)
> Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to add UUID: Failed (0x03)
> Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to add UUID: Failed (0x03)
>
> i searched a bit the webs and found a new commit at kernel org that
> does do the trouble:
> https://bugs.archlinux.org/task/78980
>
> follow the linkeys inside the commits there or read this one:
>
> ---------------before------------------------------------
> /* interface numbers are hardcoded in the spec */
> if (intf->cur_altsetting->desc.bInterfaceNumber != 0) {
> if (!(id->driver_info & BTUSB_IFNUM_2))
> return -ENODEV;
> if (intf->cur_altsetting->desc.bInterfaceNumber != 2)
> return -ENODEV;
> }
> -----------after----------------------------------------------------
> if ((id->driver_info & BTUSB_IFNUM_2) &&
> (intf->cur_altsetting->desc.bInterfaceNumber != 0) &&
> (intf->cur_altsetting->desc.bInterfaceNumber != 2))
> return -ENODEV;
> --------------------------------------------------------
>
> the dude just hooked up 3 conditions in a row with && where before it
> was 2 conditions in 1 condition. + the comment was removed.
>
>

Try latest mainline first (currently v6.6-rc4). Because you have to
compile your own kernel, please refer to
Documentation/admin-guide/quickly-build-trimmed-linux.rst if you don't know how to do the compilation.

Also, don't top-post when replying; reply inline with appropriate context
instead.

Thanks.

--
An old man doll... just what I always wanted! - Clara


Attachments:
(No filename) (2.00 kB)
signature.asc (235.00 B)
Download all attachments

2023-10-03 12:26:11

by Erik Dobák

[permalink] [raw]
Subject: Re: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

On Tue, 3 Oct 2023 at 01:47, Bagas Sanjaya <[email protected]> wrote:
>
> On Sun, Oct 01, 2023 at 07:47:54AM +0200, Erik Dobák wrote:
> > Hello!
> >
> > I bought a new laptop fujitsu life book and everything is going fine
> > on artix just the bt makes trouble:
> >
> > /var/log/error.log
> > Sep 30 18:43:48 nexus bluetoothd[2266]:
> > src/adapter.c:reset_adv_monitors_complete() Failed to reset Adv
> > Monitors: Failed (0x03)
> > Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to clear UUIDs: Failed (0x03)
> > Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to add UUID: Failed (0x03)
> > Sep 30 18:43:48 nexus bluetoothd[2266]: Failed to add UUID: Failed (0x03)
> >
> > i searched a bit the webs and found a new commit at kernel org that
> > does do the trouble:
> > https://bugs.archlinux.org/task/78980
> >
> > follow the linkeys inside the commits there or read this one:
> >
> > ---------------before------------------------------------
> > /* interface numbers are hardcoded in the spec */
> > if (intf->cur_altsetting->desc.bInterfaceNumber != 0) {
> > if (!(id->driver_info & BTUSB_IFNUM_2))
> > return -ENODEV;
> > if (intf->cur_altsetting->desc.bInterfaceNumber != 2)
> > return -ENODEV;
> > }
> > -----------after----------------------------------------------------
> > if ((id->driver_info & BTUSB_IFNUM_2) &&
> > (intf->cur_altsetting->desc.bInterfaceNumber != 0) &&
> > (intf->cur_altsetting->desc.bInterfaceNumber != 2))
> > return -ENODEV;
> > --------------------------------------------------------
> >
> > the dude just hooked up 3 conditions in a row with && where before it
> > was 2 conditions in 1 condition. + the comment was removed.
> >
> >
>
> Try latest mainline first (currently v6.6-rc4). Because you have to
> compile your own kernel, please refer to
> Documentation/admin-guide/quickly-build-trimmed-linux.rst if you don't know how to do the compilation.
>
> Also, don't top-post when replying; reply inline with appropriate context
> instead.
>
> Thanks.
>
> --
> An old man doll... just what I always wanted! - Clara

Hi i booted now into linux-6.6-rc4 and the issue is still there. No
bluetooth devices are discovered.
with this device: Bus 001 Device 004: ID 04c5:1670 Fujitsu, Ltd Bluetooth Radio

E

2023-10-03 12:43:14

by Erik Dobák

[permalink] [raw]
Subject: Re: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

On Tue, 3 Oct 2023 at 14:32, Tomasz Moń <[email protected]> wrote:
>
> On Tue, 2023-10-03 at 14:25 +0200, Erik Dobák wrote:
> > Hi i booted now into linux-6.6-rc4 and the issue is still there. No
> > bluetooth devices are discovered.
> > with this device: Bus 001 Device 004: ID 04c5:1670 Fujitsu, Ltd Bluetooth Radio
>
> Can you please be more specific and for example attach the full
> descriptor? One way to get the descriptor would be to run:
> lsusb -d 04c5:1760 -v
>
> Best Regards,
> Tomasz Moń

Sure here you go:

# lsusb -d 04c5:1670 -v

Bus 001 Device 004: ID 04c5:1670 Fujitsu, Ltd Bluetooth Radio
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.00
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x04c5 Fujitsu, Ltd
idProduct 0x1670
bcdDevice 0.00
iManufacturer 1 Realtek
iProduct 2 Bluetooth Radio
iSerial 3 00e04c000001
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x00b1
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0000 1x 0 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0009 1x 9 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0011 1x 17 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0019 1x 25 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0019 1x 25 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0021 1x 33 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0021 1x 33 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 4 Bluetooth Radio
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0031 1x 49 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0x0031 1x 49 bytes
bInterval 1
Device Status: 0x0001
Self Powered

2023-10-03 13:08:55

by Tomasz Moń

[permalink] [raw]
Subject: Re: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

On Tue, 2023-10-03 at 14:42 +0200, Erik Dobák wrote:
> Sure here you go:
>
> # lsusb -d 04c5:1670 -v
>
> Bus 001 Device 004: ID 04c5:1670 Fujitsu, Ltd Bluetooth Radio
> Device Descriptor:
> bLength 18
> bDescriptorType 1
> bcdUSB 1.00
> bDeviceClass 224 Wireless
> bDeviceSubClass 1 Radio Frequency
> bDeviceProtocol 1 Bluetooth
> bMaxPacketSize0 64
> idVendor 0x04c5 Fujitsu, Ltd
> idProduct 0x1670
> bcdDevice 0.00
> iManufacturer 1 Realtek
> iProduct 2 Bluetooth Radio
> iSerial 3 00e04c000001
> bNumConfigurations 1
> Configuration Descriptor:
> bLength 9
> bDescriptorType 2
> wTotalLength 0x00b1
> bNumInterfaces 2
> bConfigurationValue 1
> iConfiguration 0
> bmAttributes 0xe0
> Self Powered
> Remote Wakeup
> MaxPower 500mA
> Interface Descriptor:
> bLength 9
> bDescriptorType 4
> bInterfaceNumber 0
> bAlternateSetting 0
> bNumEndpoints 3
> bInterfaceClass 224 Wireless
> bInterfaceSubClass 1 Radio Frequency
> bInterfaceProtocol 1 Bluetooth
> iInterface 4 Bluetooth Radio

I have no idea why you referred to my commits, i.e. c13380a55522
("Bluetooth: btusb: Do not require hardcoded interface numbers") later
fixed by eaac6e223a0d ("Bluetooth: btusb: Fix bluetooth on Intel
Macbook 2014") in the first place.

BTUSB_IFNUM_2 is not even getting set for this device and therefore the
patches have no impact on your issue. If you were affected, like the
Intel Macbook 2014 was, then bear in mind that the issue would manifest
as btusb driver not even binding to the device. From your emails
however it appears that the issue is something different.

I honestly don't think it has anything to do with my patches. If you
know a Linux version where your bluetooth device works, then the next
step would be to bisect to find the first bad commit.

Best Regards,
Tomasz Moń

2023-10-03 16:11:04

by Erik Dobák

[permalink] [raw]
Subject: Re: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

Sorry Tomasz,

that must have been a reality glitch with your commit (cant find the
page refering to your commit now). But yes it is probably a kernel bug
as it manifests kernels 6.4 and not in the 6.1 LTS version.

Yours

E

On Tue, 3 Oct 2023 at 15:08, Tomasz Moń <[email protected]> wrote:
>
> On Tue, 2023-10-03 at 14:42 +0200, Erik Dobák wrote:
> > Sure here you go:
> >
> > # lsusb -d 04c5:1670 -v
> >
> > Bus 001 Device 004: ID 04c5:1670 Fujitsu, Ltd Bluetooth Radio
> > Device Descriptor:
> > bLength 18
> > bDescriptorType 1
> > bcdUSB 1.00
> > bDeviceClass 224 Wireless
> > bDeviceSubClass 1 Radio Frequency
> > bDeviceProtocol 1 Bluetooth
> > bMaxPacketSize0 64
> > idVendor 0x04c5 Fujitsu, Ltd
> > idProduct 0x1670
> > bcdDevice 0.00
> > iManufacturer 1 Realtek
> > iProduct 2 Bluetooth Radio
> > iSerial 3 00e04c000001
> > bNumConfigurations 1
> > Configuration Descriptor:
> > bLength 9
> > bDescriptorType 2
> > wTotalLength 0x00b1
> > bNumInterfaces 2
> > bConfigurationValue 1
> > iConfiguration 0
> > bmAttributes 0xe0
> > Self Powered
> > Remote Wakeup
> > MaxPower 500mA
> > Interface Descriptor:
> > bLength 9
> > bDescriptorType 4
> > bInterfaceNumber 0
> > bAlternateSetting 0
> > bNumEndpoints 3
> > bInterfaceClass 224 Wireless
> > bInterfaceSubClass 1 Radio Frequency
> > bInterfaceProtocol 1 Bluetooth
> > iInterface 4 Bluetooth Radio
>
> I have no idea why you referred to my commits, i.e. c13380a55522
> ("Bluetooth: btusb: Do not require hardcoded interface numbers") later
> fixed by eaac6e223a0d ("Bluetooth: btusb: Fix bluetooth on Intel
> Macbook 2014") in the first place.
>
> BTUSB_IFNUM_2 is not even getting set for this device and therefore the
> patches have no impact on your issue. If you were affected, like the
> Intel Macbook 2014 was, then bear in mind that the issue would manifest
> as btusb driver not even binding to the device. From your emails
> however it appears that the issue is something different.
>
> I honestly don't think it has anything to do with my patches. If you
> know a Linux version where your bluetooth device works, then the next
> step would be to bisect to find the first bad commit.
>
> Best Regards,
> Tomasz Moń

2023-10-04 05:20:27

by Thorsten Leemhuis

[permalink] [raw]
Subject: Re: bluetooth issues since kernel 6.4 - not discovering other bt devices - /linux/drivers/bluetooth/btusb.c

On 03.10.23 18:10, Erik Dobák wrote:
> Sorry Tomasz,
>
> that must have been a reality glitch with your commit (cant find the
> page refering to your commit now). But yes it is probably a kernel bug
> as it manifests kernels 6.4 and not in the 6.1 LTS version.

Could you then please try a bisection to get us closer to the problem?
You might want to try mainline (e.g. 6.6-rc4) first, with a bit of luck
the problem is fixed there already; FWIW, a few BT fixes that might or
might not be relevant for your case are heading that way and will most
likely be in 6.6-rc5.

Ciao, Thorsten

> On Tue, 3 Oct 2023 at 15:08, Tomasz Moń <[email protected]> wrote:
>>
>> On Tue, 2023-10-03 at 14:42 +0200, Erik Dobák wrote:
>>> Sure here you go:
>>>
>>> # lsusb -d 04c5:1670 -v
>>>
>>> Bus 001 Device 004: ID 04c5:1670 Fujitsu, Ltd Bluetooth Radio
>>> Device Descriptor:
>>> bLength 18
>>> bDescriptorType 1
>>> bcdUSB 1.00
>>> bDeviceClass 224 Wireless
>>> bDeviceSubClass 1 Radio Frequency
>>> bDeviceProtocol 1 Bluetooth
>>> bMaxPacketSize0 64
>>> idVendor 0x04c5 Fujitsu, Ltd
>>> idProduct 0x1670
>>> bcdDevice 0.00
>>> iManufacturer 1 Realtek
>>> iProduct 2 Bluetooth Radio
>>> iSerial 3 00e04c000001
>>> bNumConfigurations 1
>>> Configuration Descriptor:
>>> bLength 9
>>> bDescriptorType 2
>>> wTotalLength 0x00b1
>>> bNumInterfaces 2
>>> bConfigurationValue 1
>>> iConfiguration 0
>>> bmAttributes 0xe0
>>> Self Powered
>>> Remote Wakeup
>>> MaxPower 500mA
>>> Interface Descriptor:
>>> bLength 9
>>> bDescriptorType 4
>>> bInterfaceNumber 0
>>> bAlternateSetting 0
>>> bNumEndpoints 3
>>> bInterfaceClass 224 Wireless
>>> bInterfaceSubClass 1 Radio Frequency
>>> bInterfaceProtocol 1 Bluetooth
>>> iInterface 4 Bluetooth Radio
>>
>> I have no idea why you referred to my commits, i.e. c13380a55522
>> ("Bluetooth: btusb: Do not require hardcoded interface numbers") later
>> fixed by eaac6e223a0d ("Bluetooth: btusb: Fix bluetooth on Intel
>> Macbook 2014") in the first place.
>>
>> BTUSB_IFNUM_2 is not even getting set for this device and therefore the
>> patches have no impact on your issue. If you were affected, like the
>> Intel Macbook 2014 was, then bear in mind that the issue would manifest
>> as btusb driver not even binding to the device. From your emails
>> however it appears that the issue is something different.
>>
>> I honestly don't think it has anything to do with my patches. If you
>> know a Linux version where your bluetooth device works, then the next
>> step would be to bisect to find the first bad commit.
>>
>> Best Regards,
>> Tomasz Moń
>
>