2

I would appreciate it guys if you help me with disabling auto suspend of USB devices in Ubuntu 16.04 on laptop.

The USB is an external audio device, in order to keep the USB device always on I usually do:

echo "on" | sudo tee /sys/bus/usb/devices/1-1/power/control

It appeared that a permanent fix would be using udev to set the USB device power/control attribute. I made a new rule and indicated that its working through writing to a file:

ACTION=="add", SUBSYSTEM=="usb", RUN+="/bin/sh -c '/bin/echo auto > /home/manar/textfile'" ,ATTR{idProduct}=="0xAAAA", ATTR{idVendor}=="0xBBBB"

Then I rewrote the rule below to set the power/control attribute:

ACTION=="add", SUBSYSTEM=="usb" ,ATTR{idProduct}=="0xAAAA", ATTR{idVendor}=="0xBBBB", TEST=="power/control" ATTR{power/control}="on"

Unfortunately the rule doesn't appear to be doing its job because the value in /sys/bus/usb/devices/1-1/power/control is auto, and the device actually turns off when idle.

Can somebody please tell me what have I been missing?

Thank you very much.

Edited:

udev test indicated a permission problem while setting the corresponding attribute, I assume now that udev usage is rather different in arch than in Ubuntu.

Finally I have found a work-around to keep USB on from this guy https://askubuntu.com/a/748864/310166

2

1 Answer 1

3

On openSUSE, I use the following udev rule (/etc/udev/rules.d/50-usb-power-always-on.rules):

ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="on"
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend" ATTR{power/autosuspend}="0"
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/autosuspend_delay_ms" ATTR{power/autosuspend_delay_ms}="0"

Then run:

udevadm control --reload
systemctl daemon-reload

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .