Re: [PATCH] usb: misc: Add driver for Motorola Solutions security accessories

From: Alan Stern
Date: Mon Dec 18 2023 - 12:57:18 EST


On Sun, Dec 17, 2023 at 09:56:34PM -0600, Yinghua Yang Yang wrote:
> Is there a way to set the auto suspend mode for a usb device without root
> permission? I think this is a general question for many usb devices.
> According to the Linux Kernel document
> https://www.kernel.org/doc/Documentation/usb/power-management.txt, by
> default the kernel disables autosuspend for all devices. So there are many
> usb devices that support autosuspend but by default autosuspend is
> disabled. In order to support autosuspend on those devices, are the only
> solutions 1) obtain root permission and write ../power/control file using a
> script

It doesn't have to be a script; any sort of program can do it. A
power-management daemon such as PowerTOP, for example.

> 2) work with the hardware vendor on a driver/kernel to write the
> autosuspend flag?

That would be kind of silly. After all, if the vendor is willing to
work with you on a kernel driver, they certainly ought to be willing to
work with you on installing a power-management userspace program. And
installing a program should be much easier than getting a new driver
into the kernel.

But to answer your question -- Yes, the only ways to modify the
autosuspend settings are from userspace or from within the kernel.

Alan Stern