[systemd-devel] Udev rules hardware database

Oliver Neukum oneukum at suse.de
Fri Nov 7 00:23:18 PST 2014


On Fri, 2014-11-07 at 08:26 +0100, Martin Pitt wrote:
> Patrick Häcker [2014-11-05 16:55 +0100]:
> > I you want to have permanent power saving activated for your devices, the 
> > recommended way is to use udev (e.g. 
> > https://wiki.archlinux.org/index.php/Power_saving#USB_autosuspend). Some 
> > [...]
> > - Is there already something like this?
> 
> By coincidence I recently noticed something interesting in sysfs: My
> USB devices seem to have an attribute "supports_autosuspend". These

They are from the kernel and tell you that the drivers for the devices
support autosuspend. It says nothing about the device itself.

> are all 1 except for my USB webcam [1] where it is 0. This sounds very
> promising indeed! So apparently the kernel now already grew either a
> heuristics or some black/whitelists?

Nothing of this sort. It is a pure driver thing and only the negative
is to be taken at face value.

> At least the current state how Linux (3.16.0) and udev (215) configure
> autosuspend seems a bit weird:
> 
>  - Some of my USB devices have power/autosuspend == "2": internal
>    laptop webcam, USB webcam ([1] again), USB Keyboard, USB mouse.

2 is the kernel's default for the general case.

>    All others have "0". There is no udev rule or other thing on my
>    system to set those, so unless it's udev or systemd itself I guess
>    it's from the kernel.

Drivers in the kernel can change it with
pm_runtime_set_autosuspend_delay()

>  - Most of my USB devices have power/level=="auto" (i. e. suspend
>    enabled), only some of them are "on" (i. e. suspend disabled).
>    Curiously those which are "on" are three of above devices where
>    autosuspend==2: USB webcam, USB Keyboard, USB mouse.

Again drivers can enable it with usb_enable_autosuspend()
This can not be done for HID devices, because for most mice
remote wakeup isn't usable in the generic case.

>  - The only udev rule which I'm aware of that does autosuspend is
>    42-usb-hid-pm.rules:
> 
>    ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTRS{removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
> 
> So it does not seem to be the case that we don't currently enable
> autosuspend at all, but it's currently highly inconsistant and
> confusing.

It is inconsistent. That is at least partially to the inability to find
general rules.

	Regards
		Oliver




More information about the systemd-devel mailing list