Disable USB autosuspend for specific devices

Recently I bought a new laptop. The first time I was attending a videoconference with this laptop, my network connection (using a USB Gigabit Ethernet adapter) was very flaky and my external microphone turned itself off all the time. It took me a while before I figured out that both issues had the same cause: USB autosuspend.

Apparently both devices had USB autosuspend enabled, so they turned off after a while. I'm not sure why this is, because I used the same devices on my previous laptop with the same operating system (Ubuntu 20.04 LTS) and I never saw this behaviour. Luckily USB autosuspend can be easily disabled for specific devices.

There are multiple ways to do this, for instance with udev rules. However, in my opinion the power management tool tlp offers the easiest way. If you don't have it already, install it:

$ sudo apt install tlp

Then have a look at the vendor ID and product ID of the USB devices you don't want to autosuspend:

$ lsusb
Bus 002 Device 002: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 04f2:b684 Chicony Electronics Co., Ltd Chicony USB2.0 Camera
Bus 001 Device 006: ID 0556:0001 Asahi Kasei Microsystems Co., Ltd AK5370 I/F A/D Converter
Bus 001 Device 003: ID 8087:0029 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here you see the Gigabit Ethernet adapter (with ID 0bda:8153) on the first line, and the microphone (with ID 0556:0001) on the fourth line.

Now create the file /etc/tlp.d/50-usb-autosuspend-blacklist.conf and add both IDs to the USB_BLACKLIST parameter:

USB_BLACKLIST="0bda:8153 0556:0001"

Then restart the tlp service:

$ sudo systemctl restart tlp

After reconnecting the USB devices, they won't autosuspend anymore and you can happily enjoy your videoconferences again without hardware-related interruptions.