How to disable the bluetooth of my intel wifi card

I have an intel wifi/bluetooth card in my laptop. One of the antennas got ripped off causing the bluetooth to not work, but the wifi still works.
How do I disable the bluetooth of the card from being detected?

I would like to use a bluetooth dongle instead, which isn’t being detected, but I guess that calls for another topic…

Thanks

You could try to set a udev rule under services.udev.extraRules for your bluetooth device. Details depend on your device of course.

Thanks I’ll check out what udev is.
I’m new to linux and nixos as a whole.
I add this to the configuration.nix file, yes?

I add this to the configuration.nix file, yes?

Yes, basically. You just have to figure out which rule you actually need in your case, depending on the IDs for your device. Which you might get from looking at the output of lspci or lsusb depending on what kind of device you have.

For instance on my desktop system with a bluetooth USB dongle, I can do

lsusb | grep Bluetooth

to get this:

Bus 003 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Now this being a USB device, it will be found under /dev/usb/. And since it is device 004 on bus 003, it is this file /dev/usb/003/004.

You can then use udevadm to get some info on the device:

udevadm info -q all -a /dev/bus/usb/003/004

The output basically tells you what you can do with it in udev rules. In particular my device has the attirbute ATTR{authorized}=="1" and is located on SUBSYSTEM=="usb". If you set authorized to 0 I’d assume the device will go away.

So for my USB dongle you might try the follow rule:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0a12", ATTRS{idProduct}=="0001", ATTR{authorized}="0"

The idVendor and idProduct attributes are either found in the output of udevadm or in the output of lsusb as ID 0a12:0001.

And if you adapt that to your case, that should be it. I hope :smile:

2 Likes

Thanks, This helps a lot !!!

1 Like

You’re welcome!

You can mark it as a solution if it actually worked and then post the section of your configuration.nix that you used. Then others can come and copy-paste it if they need something similar.

If it doesn’t work we shall see what the issue is.

This is what I tried:

# Disable the laptop's intel bluetooth
  services.udev.extraRules = {
  SUBSYSTEM="usb"; ATTR{idVendor}="8087"; ATTR{idProduct}="0a2a"; ATTR{authorized}="0";
  };

I tried the double == before and was getting syntax errors and now the compiler is saying that it expected a . or = in place of the second ATTR’s first {.

Could you give an example of what the syntax should look like?
Thanks

Ok, so I searched for the services.udev.extraRules on this forum and found examples for the syntax.

# Disable the laptop's intel bluetooth
  services.udev.extraRules = ''
    SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0a2a", ATTR{authorized}="0"
  '';

This compiles when I run nixos-rebuild switch but has no effect.
The udevadm info command still shows authorized as 1

Ok seems like all that was needed was to restart my laptop, and it worked!
Thanks again!