Sometime, one needs to access all attribute on a device in order to create the udev rule for this device.



$ udevadm info --query=all  -n /dev/EtherCAT0 --attribute-walk

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/virtual/EtherCAT/EtherCAT0':
    KERNEL=="EtherCAT0"
    SUBSYSTEM=="EtherCAT"
    DRIVER==""



So, based on this output, we can create the udev rules in /etc/udev/rules.d/99-ethercat.rules  as follows:


KERNEL=="EtherCAT*", SUBSYSTEM=="EtherCAT", MODE="0666"


저작자 표시 비영리 변경 금지
신고
posted by citadel

Sometime, I would like to get only the mac address of the ethernet device. so here is the command line to do this.



ip addr show dev enp5s0 | grep "link/ether" | awk '{print $2}'

저작자 표시 비영리 변경 금지
신고
posted by citadel


I have ifc1410-ioxos-161103 in /export/nfsroots/, and would like to copy the entire dir in the different name.


$ mkdir ifc1410-ioxos-161103-rules-test


$ cd ifc1410-ioxos-161103


$ sudo -E tar cf - . | (cd /export/nfsroots/ifc1410-ioxos-161103-rules-test/ && tar xBf -)


Reference   http://www.linuxdevcenter.com/pub/a/linux/lpt/18_16.html

저작자 표시 비영리 변경 금지
신고
posted by citadel