Question

I'm trying to write a udev rule on my Beaglebone White that runs when a Pantech UML 295 finishes booting.

When using udevadm monitor --environment I get the following final output which I would like to base the rule on:

UDEV [3163.454297] add /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-
1:1.0/net/eth1 (net)
ACTION=add
DEVPATH=/devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1/1-1:1.0/net/eth1
ID_BUS=usb
ID_MODEL=PANTECH_UML295
ID_MODEL_ENC=PANTECH\x20UML295
ID_MODEL_ID=6064
ID_REVISION=0228
ID_SERIAL=Pantech__Incorporated_PANTECH_UML295_UML295692146818
ID_SERIAL_SHORT=UML295692146818
ID_TYPE=generic
ID_USB_DRIVER=cdc_ether
ID_USB_INTERFACES=:020600:0a0000:030000:
ID_USB_INTERFACE_NUM=00
ID_VENDOR=Pantech__Incorporated
ID_VENDOR_ENC=Pantech\x2c\x20Incorporated
ID_VENDOR_ID=10a9
IFINDEX=6
INTERFACE=eth1
SEQNUM=1151
SUBSYSTEM=net
SYSTEMD_ALIAS=/sys/subsystem/net/devices/eth1
TAGS=:systemd:
USEC_INITIALIZED=3163023666

My udev rule version 1:

ENV{ID_BUS}=="usb", SUBSYSTEM=="net", RUN+="/home/root/rebootInternetConnection.sh", ENV{ID_MODEL}=="PANTECH_UML295", ACTION=="add", INTERFACE=="eth1", ENV{ID_USB_DRIVER}=="cdc_ether"

and version 2:

ACTION=="add", SUBSYSTEM=="net", RUN+="/home/root/rebootInternetConnection.sh"

Version 2 is a stripped down version which should be ran more than once, but doesn't get ran at all. Version 1 uses environment variables which I'm not sure whether or not the rule has access to.

To clarify: the rule doesn't get ran at all, and the shell script has echos which should show up. My rule is in the /etc/udev/rules.d/ directory with name 10-local.rules.

Here are some more non-functional rules, placed in /etc/udev/rules.d/81-pantech.rules:

ACTION=="add", SUBSYSTEM=="net", ATTR{idVendor}=="10a9", RUN+="/home/root/reboot
InternetConnection.sh"

SUBSYSTEM=="net", ATTR{idVendor}=="10a9", ATTR{idProduct}=="6064", RUN+="/home/ro
ot/rebootInternetConnection.sh"

ACTION=="add", SUBSYSTEM=="hid", RUN+="/home/root/rebootInternetConnection.sh"

ACTION=="add", SUBSYSTEM=="usb", RUN+="echo foo > /tmp/foo"

SUBSYSTEM=="usb", ATTR{product}=="PANTECH UML295", RUN +="echo foo > /tmp/foo"

ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="PANTECH UML295", RUN+="/home/ro
ot/rebootInternetConnection.sh"
Was it helpful?

Solution

Not sure what changed, but the rule is now being used in the file /etc/udev/rules.d/81-pantech.rules

One possibility is the missing /run/udev/rules.d/ directory. When I ran

udevadm test /devices/platform/omap/musb-ti81xx/musb-hdrc.1/usb1/1-1

I got a line reporting that the directory was missing.

Another possibility is me manually running the udev daemon with

/lib/udev/udevd --debug
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top