Re: udev ATTR can have double dots and help writing a rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Di, 01.12.20 02:17, Konomi (konomikitten@xxxxxxxxx) wrote:

> So this is the eventual rule I ended up writing after having a lot of
> trouble writing a udev rule:
>
> `ACTION=="add", SUBSYSTEM=="ata_port", KERNEL=="ata[0-9]",
> TEST=="../../power/control" ATTR{../../power/control}="auto"`
>
> Here is the rule working:
>
> ```
> Dec 01 01:33:16 arch systemd-udevd[267]: ata1:
> /etc/udev/rules.d/user-powertop-tunables.rules:5 ATTR
> '/sys/devices/pci0000:00/0000:00:13.0/ata1/ata_port/ata1/../../power/control'
> writing 'auto'
> Dec 01 01:33:16 arch systemd-udevd[258]: ata2:
> /etc/udev/rules.d/user-powertop-tunables.rules:5 ATTR
> '/sys/devices/pci0000:00/0000:00:13.0/ata2/ata_port/ata2/../../power/control'
> writing 'auto'
> ```
>
> Is this a good udev rule or even valid or is using `..` something that
> shouldn't be possible?

No, that's OK, we do that from time to time too. Of course, I'd avoid
it unless there's no better way to match the device. i.e. if you can
recognize a device by its own properties it's typically much better
than recognizing some subdevice further down and then making change
up-top again.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux