[systemd-devel] [PATCH] 42-usb-hid-pm.rules: Fix tests for removable state

David Herrmann dh.herrmann at gmail.com
Sat Apr 11 03:24:29 PDT 2015


Hi

On Thu, Apr 9, 2015 at 3:58 AM, Matthew Garrett <mjg59 at srcf.ucam.org> wrote:
> From: Matthew Garrett <mjg59 at coreos.com>
>
> We only care about whether our direct parent is removable, not whether any
> further points up the tree are - the kernel will take care of policy for
> those itself. This enables autosuspend on devices where the root hub reports
> that its removable state is unknown.
> ---
>  rules/42-usb-hid-pm.rules | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

We usually don't want fixed-path access to parent sysfs entries, as
the hierarchy is not guaranteed to be stable. However, in this case,
we actually want the direct parent, regardless of who it is. So this
looks fine to me!

Applied!

Thanks
David

> diff --git a/rules/42-usb-hid-pm.rules b/rules/42-usb-hid-pm.rules
> index 4c300da..3721219 100644
> --- a/rules/42-usb-hid-pm.rules
> +++ b/rules/42-usb-hid-pm.rules
> @@ -28,9 +28,9 @@ ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}=="0002"
>
>  # USB HID devices that are internal to the machine should also be safe to autosuspend
>
> -ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="removable", GOTO="usb_hid_pm_end"
> -ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="unknown", GOTO="usb_hid_pm_end"
> +ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{../removable}=="removable", GOTO="usb_hid_pm_end"
> +ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{../removable}=="unknown", GOTO="usb_hid_pm_end"
>
> -ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTRS{removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
> +ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTR{../removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto"
>
>  LABEL="usb_hid_pm_end"
> --
> 2.1.0
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list