Resetting a PCI device

The Wi-Fi adapter on my VivoBook 17 has been acting up under Ubuntu 18.04 LTS insofar that at a random point in time, possibly accelerated by power saving features, the Wi-Fi will stop working with suspicious syslog entries:

ath10k_pci 0000:03:00.0: failed to wake target for read32 at 0x0003a028: -110

The usual tricks (suspend/resume, reload driver, aeroplane mode) don’t help.

A bit of searching [1] and filling out blanks leads me to believe that the Atheros Wi-Fi adapter needs to undergo a hard-reset by removing it from the PCI bus and triggering a device scan.

The script can be found in my github repository [2]. The driver name is configured with the “driver_name” variable and the device name in “device_name”. The script locates the PCI ID for the device, finds the corresponding entry in the Linux device tree and removes it. After that, a PCI device scan is triggered which re-adds the device. I’m not 100% sure whether the driver needs to be reloaded, the script does it anyway.

Resources

[1] Resetting PCI device in Linux
https://unix.stackexchange.com/questions/29775/reset-a-pci-device-in-linux/42358

[2] reset-pci-device
https://github.com/ggeorgovassilis/linuxscripts/tree/master/reset-pci-device

One thought on “Resetting a PCI device

  1. Hello. I experience the same issue with an Atheros QCA9377 (Asus VivoBook 15) and Linux Mint 19.3. At some point the wifi stops working and the touchpad too. I’ll try with your script next time I have the issue instead of reset the laptop 🙂
    Thanks

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.