[Bug 60824] [PATCH][regression] Cambridge Silicon Radio, Ltd Bluetooth Dongle unusable

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

 



https://bugzilla.kernel.org/show_bug.cgi?id=60824

Reginaldo Coimbra Vieira (recovieira@xxxxxxxxxxx) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |recovieira@xxxxxxxxxxx

--- Comment #207 from Reginaldo Coimbra Vieira (recovieira@xxxxxxxxxxx) ---
Hello everyone! Well, I got it and I am going to share my experience with all
of you, guys, and I do hope this is going to be fixed in the kernel soon.

The problem happens when the event HCI_OP_SET_EVENT_FLT (Clear Event Filters)
is triggered. I thought: what would come up if that event did not happen at
all? So, I tried to skip it...

In the file include/net/bluetooth/hci.h, there are a couple of quirks to be
applied against some device. Maybe, a new one could be created to address such
specific problem (e.g.: HCI_QUIRK_CLEAR_EVENT_FAILURE or something like that)
for good practices. Anyways... I have used the quirk
HCI_QUIRK_BROKEN_ERR_DATA_REPORTING that is already used to address other
problems of that same particular driver to address that another problem too.

So, in the file net/bluetooth/hci_core.c, I have changed the function
bredr_setup this way (this is the function that causes that problem that
prevents it from being recognised as a controller):

static void bredr_setup(struct hci_request *req)
{
        __le16 param;
        //__u8 flt_type;        // move this line into the "if" below

        /* Read Buffer Size (ACL mtu, max pkt, etc.) */
        hci_req_add(req, HCI_OP_READ_BUFFER_SIZE, 0, NULL);

        /* Read Class of Device */
        hci_req_add(req, HCI_OP_READ_CLASS_OF_DEV, 0, NULL);

        /* Read Local Name */
        hci_req_add(req, HCI_OP_READ_LOCAL_NAME, 0, NULL);

        /* Read Voice Setting */
        hci_req_add(req, HCI_OP_READ_VOICE_SETTING, 0, NULL);

        /* Read Number of Supported IAC */
        hci_req_add(req, HCI_OP_READ_NUM_SUPPORTED_IAC, 0, NULL);

        /* Read Current IAC LAP */
        hci_req_add(req, HCI_OP_READ_CURRENT_IAC_LAP, 0, NULL);

        // Changed lines by me are below

        //flt_type = HCI_FLT_CLEAR_ALL;         // replaced this line to the
following
        //hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type); // replaced
this line to the following

        /* Clear Event Filters if the device is able to do so */
        if (!test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &req->hdev->quirks))
{
                __u8 flt_type;

                flt_type = HCI_FLT_CLEAR_ALL;
                hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &flt_type);
        }

        // Change ends here

        /* Connection accept timeout ~20 secs */
        param = cpu_to_le16(0x7d00);
        hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, &param);
}

Then, I just compile that driver from the /usr/src folder, copy the
/pathToTheChangedKernel/net/bluetooth/bluetooth.ko to
/lib/modules/kernel/extra/bluetooth.ko and run the depmod. Change the paths
below accordingly to where the source of your system kernel and your changed
kernel are.

# cd /usr/src/kernels/5.14.17.x86_64
# make M=/pathToTheChangedKernel/net/bluetooth bluetooth.ko
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/af_bluetooth.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/hci_core.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/hci_conn.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/hci_event.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/mgmt.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/hci_sock.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/hci_sysfs.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/l2cap_core.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/l2cap_sock.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/smp.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/lib.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/ecdh_helper.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/hci_request.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/mgmt_util.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/mgmt_config.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/sco.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/leds.o
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/msft.o
  LD [M]  /kernel/5.14.17.x86_64/net/bluetooth/bluetooth.o
  MODPOST /kernel/5.14.17.x86_64/net/bluetooth/Module.symvers
  CC [M]  /kernel/5.14.17.x86_64/net/bluetooth/bluetooth.mod.o
  LD [M]  /kernel/5.14.17.x86_64/net/bluetooth/bluetooth.ko
  BTF [M] /kernel/5.14.17.x86_64/net/bluetooth/bluetooth.ko

# cp /pathToTheChangedKernel/net/bluetooth/bluetooth.ko
/lib/modules/5.14.17.x86_64/extra/bluetooth.ko
# depmod -aeF /boot/System.map 5.14.17.x86_64

The warning below still appears in the log, but it has not represented any
negative impact at all for me:

Bluetooth: hci0: CSR: Failed to suspend the device for our Barrot 8041a02
receive-issue workaround

For me, it is working perfectly from that change on. Woohoo!!! I do hope some
snippet code like that one would be inserted into the kernel soon.

I do hope that it works perfectly for you too and let's get some pint of beer
to celebrate. It did not beat us. We all beat it instead! Please, give me
feedback :)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are the assignee for the bug.



[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