So I’ve loaded Pop!OS 20.04 onto a couple different machines at this point. While it’s mostly great, I’ve found myself resolving a handful of power management issues.
The first time around, I was having issues with waking from suspend. This time, it’s an annoying bluetooth mouse issue.
For whatever reason, the mouse on this particular laptop — a Dell XPS 13 Developer Edition — seems to sleep arbitrarily every 10 seconds or so and then takes a couple seconds to reconnect every time I touch the mouse. It’s kind of like Chinese water torture. Turns out it’s a feature that’s meant to be useful for most peripherals and it’s called “autosuspend”.
I’ve found myself in various bluetooth configuation files with mixed results. What has worked is a package I found called PowerTOP, which admittedly, sounds like an Always Sunny reference of some kind.
sudo apt install powertop
sudo powertop
This is going to open a windowed command line interface. Press TAB until you get to the “Tunables” tab. In here you’ll see lots of settings that say “Good” or “Bad” next to them.
You’re going to want to find the Autosuspend setting for the USB device that corresponds to your Bluetooth radio and make sure it’s “Bad”. Bad here means that your machine isn’t configured to conserve power on that device after a predetermined timeout window.
This of course assumes you know which USB device corresponds do your bluetooth radio. If you don’t know that yet, then do this.
cd /sys/bus/usb/drivers/btusb
ls
The first couple things listed in there will be the USB device that your Bluetooth radio depends on. Mine happens to be 3-10.
Powertop only makes changes for that session. If you want to make changes permanent, you’ll need to do some additional steps.
Making it stick
If you go and research this issue, you’ll find a lot of older instructions that tell you to edit the /etc/rc.local file. And this will work fine on many distributions of Linux.
However, in this brave new world of systemd and things, on PopOS, you may get suspicious when you try an open the rc.local file to find that it doesn’t yet exist. That’s how I feel whenever I find that I’m creating a system file like that.
If rc.local were relevant on your machine, here’s what you would do. You would add the following to /etc/rc.local
echo 'on' > /sys/bus/usb/devices/3-10/power/control
You’ll need to adjust the name of your device based on your particular machine’s settings.
But if that fails, you have to do a weirder move and edit some udev rules.
Setting udev rules
First of all lets do this.
lsusb -v
You’re going to see a lot of stuff. But find your USB device that maps to your Bluetooth radio.
Bus 001 Device 006: ID 8087:0026 Intel Corp.
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.01
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x8087 Intel Corp.
idProduct 0x0026
bcdDevice 0.02
iManufacturer 0
iProduct 0
iSerial 0
bNumConfigurations 1
These attributes will come in handy.
Now do this
sudo vim /etc/udev/rules.d/usb-power.rules
So what we’re doing is establishing a rules configuration. The name could have been anything. You’ll notice the “udev” and the “rules.d”.
udev is the linux subsystem that manages device events. That means it makes decisions about what to do when stuff is plugged into your computer.
The “.d” means this is going to run as a daemon or background service. Linux will run these rules as part of the bootstrapping process for the udev service.
Add something like this
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", ATTR{idProduct}=="0026", ATTR{power/autosuspend}="-1"
You’ll notice I took the 0x off of the hex values. udev rules don’t like the hex prefix, so don’t use it.
Most of the equal signs here are for comparison. The last one is the only thing making changes. You have a couple options for trying to affect this setting. The first is “power/control” which you can set to “on”. But I found that ineffective. The other option is to modify “power/autosuspend” which usually accepts a value in seconds. But when it’s “-1” it means.. don’t autosuspend ever.