[systemd-devel] Udev rules hardware database

Lennart Poettering lennart at poettering.net
Fri Nov 7 03:55:17 PST 2014


On Fri, 07.11.14 09:23, Oliver Neukum (oneukum at suse.de) wrote:

> > 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.

So what would you recommend we do?

Experiment with turning auto-suspend on by default and then start
building a blacklist if we get reports that things stop working?

And that blacklist should that live in hwdb in userspace or be
maintained as quirks list in the kernel, compiled in?

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list