azdanov
1
Hey!
Could someone guide me on how would it be possible to patch the btusb
for kernel?
In particular this: https://github.com/torvalds/linux/blob/ccb98ccef0e543c2bd4ef1a72270461957f3d8d0/drivers/bluetooth/btusb.c#L371-L379
I found a guide, but unfortunately it’s for ubuntu: https://www.collabora.com/news-and-blog/blog/2021/05/05/quick-hack-patching-kernel-module-using-dkms/
I wish to add my card’s specific ids for it to work:
lspci -nn | grep -E 'Network|Bluetooth'
02:00.0 Network controller [0280]: Qualcomm Technologies, Inc WCN785x Wi-Fi 7(802.11be) 320MHz 2x2 [FastConnect 7800] [17cb:1107] (rev 01)
Someone already tried submitting a kernel patch, so I would like to do something similar, just replacing the ids in the patch with my own: https://patchwork.kernel.org/project/bluetooth/patch/20241121180742.156230-1-greyxor@protonmail.com/
Can check what this thread for more context: https://community.frame.work/t/guide-successful-wi-fi-7-802-11be-on-framework-13-amd-with-qualcomm-qcncm865-and-arch-linux/44723/173
Thanks 
I’ve used AI for some help, but I lack knowledge of linux to confirm if it’s correct or not.
Summary
To patch the btusb
kernel module on Arch Linux and add your card’s specific IDs, you can follow these steps:
1. Prepare the Environment
2. Create a DKMS Module
-
Create a directory for the DKMS module:
sudo mkdir -p /usr/src/btusb-0.1
-
Create the dkms.conf
file in /usr/src/btusb-0.1
with the following content:
PACKAGE_NAME="btusb"
PACKAGE_VERSION="0.1"
BUILT_MODULE_NAME[0]="btusb"
DEST_MODULE_LOCATION[0]="/updates/dkms/"
AUTOINSTALL="yes"
REMAKE_INITRD="yes"
PRE_BUILD="dkms-patchmodule.sh drivers/bluetooth"
3. Retrieve and Modify the Patch
-
Download the patch from the kernel repository or create your own based on the example:
wget -O /usr/src/btusb-0.1/add-qualcomm-id.patch https://patchwork.kernel.org/project/bluetooth/patch/20241121180742.156230-1-greyxor@protonmail.com/
-
Modify the patch to include your card’s VID and PID (17cb:1107
):
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -375,6 +375,8 @@ static const struct usb_device_id quirks_table[] = {
BTUSB_WIDEBAND_SPEECH },
{ USB_DEVICE(0x0489, 0xe0f3), .driver_info = BTUSB_QCA_WCN6855 |
BTUSB_WIDEBAND_SPEECH },
+ { USB_DEVICE(0x17cb, 0x1107), .driver_info = BTUSB_QCA_WCN6855 |
+ BTUSB_WIDEBAND_SPEECH },
{ USB_DEVICE(0x13d3, 0x3623), .driver_info = BTUSB_QCA_WCN6855 |
BTUSB_WIDEBAND_SPEECH },
4. Create the Patching Script
-
Add the dkms-patchmodule.sh
script in /usr/src/btusb-0.1
:
sudo nano /usr/src/btusb-0.1/dkms-patchmodule.sh
-
Script content:
#!/bin/bash
kernelver=$(uname -r)
src_dir="/usr/src/linux-headers-${kernelver}"
module_dir="${src_dir}/drivers/bluetooth"
echo "Patching btusb module..."
cp -r ${module_dir} .
patch -p1 < add-qualcomm-id.patch
-
Make it executable:
sudo chmod +x /usr/src/btusb-0.1/dkms-patchmodule.sh
5. Build and Install the Module
-
Add the module to DKMS:
sudo dkms add -m btusb -v 0.1
-
Build and install the module:
sudo dkms build -m btusb -v 0.1
sudo dkms install -m btusb -v 0.1
-
Update the initramfs:
sudo mkinitcpio -P
6. Reboot and Test
Notes
- This approach uses DKMS to patch the kernel module dynamically, avoiding the need to recompile the entire kernel.
- The patch you referenced is a good starting point; ensure you adapt it to your specific VID/PID.
system
Closed
3
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.