You are not logged in.

#1 2015-07-07 14:46:40

cebonet
Member
Registered: 2015-07-07
Posts: 4

[SOLVED] Udev auto-suspend rule only triggered when replugging device

I have an usb mouse connected to my macbook air. I've noticed that the mouse is suspended when idle for 2 seconds, so I have to wait for it to wake up every time to use it and that is really annoying. I found out usb auto-suspending is causing this behaviour. To disable the auto-suspending of the usb device I have tried every option I can find. Even tried to disable it for usbcore.

I tried disabling it using modprobe.d:

 
# /etc/modprobe.d/66-disable-autosuspend.conf
options usbcore autosuspend=-1 # also tried 0

Did not work, so I tried disabling it in sys modules:

echo -n -1 > /sys/module/usbcore/parameters/autosuspend

No luck. I tried changing kernel boot parameters by editing GRUB_CMDLINE_LINUX_DEFAULT int the grub file:

#/etc/default/grub 
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"

Did not work either, auto-suspend still active. As last I got some progress by adding udev rules:

#/etc/udev/rules.d/99-local.rules 
# Disable auto-suspending on mx-master mouse
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c52b", TEST=="power/control", ATTR{power/control}="on"

I have noticed that udev rule only kicks in when the mouse is unplugged and then plugged in again during runtime. I have checked this using the script:

 for d in /sys/bus/usb/devices/[0-9]* ; do if [[ -e $d/product ]] ; then echo -e "`basename $d`\t`cat $d/power/control`\t`cat $d/speed`\t`cat $d/product`" ; fi ; done

How can I make sure the usb auto-suspend udev rule also kicks in during boot? Replugging every time I reboot is not practical.

I have also noticed an output in dmesg, that might be relative, but could not find any information about:

[  723.075183] pci_pm_runtime_suspend(): hcd_pci_runtime_suspend+0x0/0x60 [usbcore] returns -16

For your information, I do not have laptop-mode installed on my computer and I have also tried disabling other power managers like, powertop and cpupower.

Last edited by cebonet (2015-07-07 17:41:03)

Offline

#2 2015-07-07 16:50:23

laloch
Member
Registered: 2010-02-04
Posts: 186

Re: [SOLVED] Udev auto-suspend rule only triggered when replugging device

Hi cebonet,
it may be, that the USB subsystem with all it's modules "kicks in" too early before the root FS is mounted. Try to add your extra .rules files to your initramfs image by including them in the FILES variable of your mkinitcpio.conf and rebuilding the initramfs.

Offline

#3 2015-07-07 17:16:06

cebonet
Member
Registered: 2015-07-07
Posts: 4

Re: [SOLVED] Udev auto-suspend rule only triggered when replugging device

Thanks for your suggestion laloch, but that did not seem to work either :-(

Offline

#4 2015-07-07 17:39:18

cebonet
Member
Registered: 2015-07-07
Posts: 4

Re: [SOLVED] Udev auto-suspend rule only triggered when replugging device

I managed to solve the problem by installing laptop-mode-tools and change the configurations file to disable auto-suspend. I also blaklisted my device just to be sure. Here is the whole file:

#  /etc/laptop-mode/conf.d/runtime-pm.conf
# Enable debug mode for this module
# Set to 1 if you want to debug this module
DEBUG=0

# Enable Runtime autosuspend feature?
# Set to 0 to disable
CONTROL_RUNTIME_AUTOSUSPEND=0

# Set this to use opt-in/whitelist instead of opt-out/blacklist for deciding
# which devices should be autosuspended.
# AUTOSUSPEND_USE_WHITELIST=0 means AUTOSUSPEND_*_BLACKLIST will be used.
# AUTOSUSPEND_USE_WHITELIST=1 means AUTOSUSPEND_*_WHITELIST will be used.
AUTOSUSPEND_USE_WHITELIST=0

# The list of Device IDs that should not use autosuspend. Use system commands or
# look into sysfs to find out the IDs of your devices.
# Example: AUTOSUSPEND_DEVID_BLACKLIST="046d:c025 0123:abcd"
AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST="046d:c52b"

# The list of device driver types that should not use autosuspend.  The driver
# type is given by "DRIVER=..." in a device's uevent file.
# Example: AUTOSUSPEND_DEVID_BLACKLIST="usbhid usb-storage"
AUTOSUSPEND_RUNTIME_DEVTYPE_BLACKLIST=""

# The list of Device IDs that should use autosuspend. Use system commands or
# look into sysfs to find out the IDs of your devices.
# Example: AUTOSUSPEND_DEVID_WHITELIST="046d:c025 0123:abcd"
AUTOSUSPEND_RUNTIME_DEVID_WHITELIST=""

# The list of device driver types that should use autosuspend.  The driver
# type is given by "DRIVER=..." in a device's uevent file.
# Example: AUTOSUSPEND_DEVTYPE_WHITELIST="usbhid usb-storage"
AUTOSUSPEND_RUNTIME_DEVTYPE_WHITELIST=""

# Trigger auto-suspension of the deivce under conditional circumstances
# Warning: DO NOT CHANGE THESE DEFAUTLS UNLESS YOU KNOW
BATT_SUSPEND_RUNTIME=1
LM_AC_SUSPEND_RUNTIME=1
NOLM_AC_SUSPEND_RUNTIME=1

# Auto-Suspend timeout in seconds
# Number of seconds after which the USB devices should suspend
AUTOSUSPEND_TIMEOUT=30

Last edited by cebonet (2015-07-07 17:39:41)

Offline

Board footer

Powered by FluxBB