You are not logged in.

#1 2014-08-09 10:30:24

PL_kolek
Member
Registered: 2012-02-21
Posts: 41

[SOLVED]How to disable USB autosuspend?

Hello!
A long time ago I installed Arch on my notebook and configured it's power saving using laptop-mode-tools. I also installed pm-utils for suspend/hibernate. USB autosuspend worked correctly - on battery every device (including mouse) was suspending and no autosuspend at all on AC. Some time ago, I don't remember when exactly, it stopped working. Now, no matter what, my mouse turns off after 2 seconds.

Here is what I did:
1. Checked my laptop-mode-tools configuration (removed comments for brevity):

cat /etc/laptop-mode/conf.d/usb-autosuspend.conf 

DEBUG=0
CONTROL_USB_AUTOSUSPEND="auto"
AUTOSUSPEND_USE_WHITELIST=0
AUTOSUSPEND_USBID_BLACKLIST=""
AUTOSUSPEND_USBTYPE_BLACKLIST=""
AUTOSUSPEND_USBID_WHITELIST=""
AUTOSUSPEND_USBTYPE_WHITELIST=""

BATT_SUSPEND_USB=1
LM_AC_SUSPEND_USB=0
NOLM_AC_SUSPEND_USB=0

AUTOSUSPEND_TIMEOUT=2

So far looks good.
2. According to wiki, pm-utils might conflict with laptop-mode-tools. So I created a dummy file in /etc/pm/power.d for each of the scripts from /usr/lib/pm-utils/power.d . For the moment I don't care if I disabled too much. I just hope laptop-mode-tools covers all powersaving features.

ls -l /etc/pm/power.d 
-rw-r--r-- 1 root root 0 08-08 19:58 hal-cd-polling
-rw-r--r-- 1 root root 0 08-08 19:58 intel-audio-powersave
-rw-r--r-- 1 root root 0 08-08 19:58 journal-commit
-rw-r--r-- 1 root root 0 08-08 19:36 laptop-mode
-rw-r--r-- 1 root root 0 08-08 19:58 readahead
-rw-r--r-- 1 root root 0 08-08 19:58 sata_alpm
-rw-r--r-- 1 root root 0 08-08 19:58 sched_powersave
-rw-r--r-- 1 root root 0 08-08 19:58 wireless
-rw-r--r-- 1 root root 0 08-08 19:59 xfs_buffer

ls -l /usr/lib/pm-utils/power.d 
-rwxr-xr-x 1 root root 1316 2013-05-30  hal-cd-polling*
-rwxr-xr-x 1 root root  870 2013-05-30  intel-audio-powersave*
-rwxr-xr-x 1 root root 1290 2013-05-30  journal-commit*
-rwxr-xr-x 1 root root 2722 2013-05-30  laptop-mode*
-rwxr-xr-x 1 root root  201 2013-05-30  pcie_aspm*
-rwxr-xr-x 1 root root 1222 2013-05-30  readahead*
-rwxr-xr-x 1 root root 1131 2013-05-30  sata_alpm*
-rwxr-xr-x 1 root root  652 2013-05-30  sched-powersave*
-rwxr-xr-x 1 root root 2495 2013-05-30  wireless*
-rwxr-xr-x 1 root root 1642 2013-05-30  xfs_buffer*

Still no luck.

3. As I found out, there is some kernel option CONFIG_PM_RUNTIME, which allows the kernel to autosuspend usb devices: source. It's on:

cat /proc/config.gz| gunzip | grep CONFIG_USB_SU                                                       
CONFIG_USB_SUPPORT=y

And as I read here I can disable usb autosuspend using boot parameter. So i edited my /etc/default.grub, and now my grub.cfg looks like this:

sudo cat /boot/grub/grub.cfg | grep usb
	linux	/boot/vmlinuz-linux root=UUID=d18cd4a4-2ebf-4874-80ff-8520016b0ed4 rw  quiet usbcore.autosuspend=-1
		linux	/boot/vmlinuz-linux root=UUID=d18cd4a4-2ebf-4874-80ff-8520016b0ed4 rw  quiet usbcore.autosuspend=-1
		linux	/boot/vmlinuz-linux root=UUID=d18cd4a4-2ebf-4874-80ff-8520016b0ed4 rw  quiet usbcore.autosuspend=-1

After rebooting I checked:

cat /sys/module/usbcore/parameters/autosuspend      
-1

Cool! It should work! But... it doesn't. The mouse still goes to sleep after 2 seconds, and:

kolzi@kolzi-laptop ~ % for i in /sys/bus/usb/devices/*/power/autosuspend_delay_ms; do cat $i;done
2000
2000
2000
2000
2000
2000
2000
2000
2000
kolzi@kolzi-laptop ~ % for i in /sys/bus/usb/devices/*/power/autosuspend; do cat $i;done 
2
2
2
2
2
2
2
2
2

Where doesn't this 2 (or 2000) come from? How disable this suspending and let laptop-mode-tools control it? What's going on?

Last edited by PL_kolek (2014-08-09 13:14:23)

Offline

#2 2014-08-09 10:47:35

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED]How to disable USB autosuspend?

You don't need pm-utils for suspension/hibernation if you're using systemd.

See how it works without laptop-mode-tools. Is your last output on battery or AC? Your laptop-mode-tools is set to set autosuspend to two seconds on battery.

Offline

#3 2014-08-09 12:01:39

PL_kolek
Member
Registered: 2012-02-21
Posts: 41

Re: [SOLVED]How to disable USB autosuspend?

Then, I guess I don't need pm-utils anymore. Good.

I'm aware that my setup of laptop-mode-tools suspends USB devices when on battery and that is desired. All outputs where on AC.

Offline

#4 2014-08-09 12:16:58

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED]How to disable USB autosuspend?

If - with laptop-mode-tools disabled - autosuspend is disabled after boot, then it means that laptop-mode-tools is at fault, and you should try to debug it, e.g. by running it with DEBUG=1 (which would perhaps show more messages in journalctl). Maybe even restarting laptop-mode-tools after boot would make a difference.

Last edited by lucke (2014-08-09 12:18:54)

Offline

#5 2014-08-09 12:26:53

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [SOLVED]How to disable USB autosuspend?

Offline

#6 2014-08-09 12:31:14

PL_kolek
Member
Registered: 2012-02-21
Posts: 41

Re: [SOLVED]How to disable USB autosuspend?

For now I run

sudo systemctl disable laptop-mode.service

and changed in /etc/laptop-mode/laptop-mode.conf

ENABLE_LAPTOP_MODE_TOOLS=0

After rebooting I still have the same issues. Also, even after disabling laptop-mode-tools, the brightness changes after unplugging the laptop, so either the laptop mode wasn't disabled at all, or there is something else 'helping' me with powersaving.

@brebs
Thank you, but it looks for me more like a workaround than a solution. It could work, but it doesn't tell me what disables my mouse and where is the root of the problem.

Last edited by PL_kolek (2014-08-09 12:39:39)

Offline

#7 2014-08-09 12:49:36

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED]How to disable USB autosuspend?

Remove laptop-mode-tools and pm-utils, to make sure they aren't doing anything. Another software which could perhaps meddle with autosuspend is TLP or acpid scripts.

Are you using some desktop environment? They like to use upower, which could be responsible for brightness' changes (check "ps ax | grep upowerd" to see if it's running) - it shouldn't meddle with autosuspend, however.

Offline

#8 2014-08-09 12:57:15

PL_kolek
Member
Registered: 2012-02-21
Posts: 41

Re: [SOLVED]How to disable USB autosuspend?

Seems like laptop-mode-tools was ignoring my everything I did... After removing it - no brightness changes, no autosuspend. I'll probably have to try tlp.

No, I'm no using any DE - I use i3.

Offline

#9 2014-08-16 20:48:26

LeCrayonVert
Member
Registered: 2010-09-01
Posts: 134

Re: [SOLVED]How to disable USB autosuspend?

It's probably been caused by a recent update of laptop-mode-tools. The usb-autosuspend.conf file has been deprecated in favor of runtime-pm.conf.


I believe in a world I can and do understand. A rational universe, explained through rational means.

Offline

Board footer

Powered by FluxBB