Compare commits

..

2 commits

Author SHA1 Message Date
Leonardo Eugênio 74e32e423c monolith: fix bluetooth dongle 2024-10-18 00:02:07 -03:00
Leonardo Eugênio a4ebb60595 monolith: use nproc as gitlab runner count 2024-10-18 00:02:07 -03:00
5 changed files with 81 additions and 2 deletions

View file

@ -38,7 +38,14 @@ in
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
boot.extraModulePackages = with config.boot.kernelPackages; [ zenpower ]; boot.extraModulePackages = with config.boot.kernelPackages; [
zenpower
(pkgs.linux-bluetooth.override {
kernel = config.boot.kernelPackages.kernel;
patches = [ ../../patches/linux/v2-Bluetooth-btusb-Fix-regression-with-CSR-controllers.diff ];
})
];
boot.initrd.kernelModules = [ "amdgpu" ]; boot.initrd.kernelModules = [ "amdgpu" ];
boot.kernelModules = [ boot.kernelModules = [
"kvm-amd" "kvm-amd"

View file

@ -0,0 +1,24 @@
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index c0b6ef8ee5da..f72218c1037e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1366,10 +1366,15 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev, gfp_t mem_flags)
if (!urb)
return -ENOMEM;
- /* Use maximum HCI Event size so the USB stack handles
- * ZPL/short-transfer automatically.
- */
- size = HCI_MAX_EVENT_SIZE;
+ if (le16_to_cpu(data->udev->descriptor.idVendor) == 0x0a12 &&
+ le16_to_cpu(data->udev->descriptor.idProduct) == 0x0001)
+ /* Fake CSR devices don't seem to support sort-transter */
+ size = le16_to_cpu(data->intr_ep->wMaxPacketSize);
+ else
+ /* Use maximum HCI Event size so the USB stack handles
+ * ZPL/short-transfer automatically.
+ */
+ size = HCI_MAX_EVENT_SIZE;
buf = kmalloc(size, mem_flags);
if (!buf) {

View file

@ -8,4 +8,5 @@ rec {
emmet-cli = pkgs.callPackage ./emmet-cli.nix { }; emmet-cli = pkgs.callPackage ./emmet-cli.nix { };
material-wifi-icons = pkgs.callPackage ./material-wifi-icons.nix { }; material-wifi-icons = pkgs.callPackage ./material-wifi-icons.nix { };
gnome-pass-search-provider = pkgs.callPackage ./gnome-pass-search-provider.nix { }; gnome-pass-search-provider = pkgs.callPackage ./gnome-pass-search-provider.nix { };
linux-bluetooth = pkgs.callPackage ./linux-bluetooth.nix { };
} }

47
pkgs/linux-bluetooth.nix Normal file
View file

@ -0,0 +1,47 @@
{
pkgs,
lib,
kernel ? pkgs.linuxPackages_latest.kernel,
patches ? [],
}:
pkgs.stdenv.mkDerivation {
pname = "bluetooth-kernel-module";
inherit (kernel)
src
version
postPatch
nativeBuildInputs
;
inherit patches;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
modulePath = "drivers/bluetooth";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
meta = {
description = "Bluetooth kernel module";
license = lib.licenses.gpl3;
};
}

View file

@ -12,7 +12,7 @@ in
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
services.gitlab-runner = { services.gitlab-runner = {
enable = true; enable = true;
settings.concurrent = 4; settings.concurrent = 12;
services = { services = {
# runner for building in docker via host's nix-daemon # runner for building in docker via host's nix-daemon
# nix store will be readable in runner, might be insecure # nix store will be readable in runner, might be insecure