在Ubuntu的udev规则

我在Ubuntu 12.04中为我的APC UPS设置了一些udev规则,并且使用了包含的*-net.rules作为参考。 当我在我的-ups.rules使用ATTR{}==""匹配时,虽然它不起作用,但我不得不切换到ATTRS{}==""才能使它工作。

现在我想知道:

  • 系统内置的eth0eth1 udev规则是否被破坏?
  • 他们应该使用ATTRS而不是ATTR
  • 我将如何检查以确保他们正在工作?
  • 我如何甚至列出networking设备的ATTRS ? 我无法find运行udevadm的设备节点。

看看udev的手册页:

 ATTR{filename} Match sysfs attribute values of the event device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. 

VS

 ATTRS{filename} Search the devpath upwards for a device with matching sysfs attribute values. If multiple ATTRS matches are specified, all of them must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. 

ATTR{}只查看正在添加的节点。 ATTRS{}search树。 您的UPS可能需要ATTRS{}因为您需要的sysfs属性不在您指定的节点。