用udevadm test add來看,rule會被讀到;但順序我試過30(最優先)和90(幾乎是最後)兩種,也都無效
我猜是不是哪裡語法有寫錯,可是從man和google來看,似乎都是正確的
使用的是ubuntu 9.10/udev 147~-6.1/libudev0 147~-6.1/kernel 2.6.31-14
附上rule和udevadm查到的資料
rule有試過兩種寫法
- 代碼: 選擇全部
SUBSYSTEM=="usb", ACTION=="add", ENV{ID_VENDOR_ID}=="0408", ENV{ID_MODEL_ID}=="1000", RUN+="/bin/sh -c 'echo suspend > /sys/$env{DEVPATH}/power/level'"
- 代碼: 選擇全部
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="0408", ATTRS{idProduct}=="1000", RUN+="/bin/sh -c 'echo suspend > /sys/$env{DEVPATH}/power/level'"
udevadm monitor --subsystem-match=usb --udev --property
- 代碼: 選擇全部
UDEV [1258620934.551464] add /devices/pci0000:00/0000:00:1d.1/usb6/6-1 (usb)
UDEV_LOG=3
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb6/6-1
SUBSYSTEM=usb
DEVNAME=/dev/bus/usb/006/007
DEVTYPE=usb_device
DEVICE=/proc/bus/usb/006/007
PRODUCT=408/1000/0
TYPE=0/0/0
BUSNUM=006
DEVNUM=007
SEQNUM=1673
ID_VENDOR=Qualcomm__Incorporated
ID_VENDOR_ENC=Qualcomm\x2c\x20Incorporated
ID_VENDOR_ID=0408
ID_MODEL=USB_MMC_Storage
ID_MODEL_ENC=USB\x20MMC\x20Storage
ID_MODEL_ID=1000
ID_REVISION=0000
ID_SERIAL=Qualcomm__Incorporated_USB_MMC_Storage_000000000002
ID_SERIAL_SHORT=000000000002
ID_BUS=usb
ID_USB_INTERFACES=:080650:
MAJOR=189
MINOR=646
DEVLINKS=/dev/char/189:646
udevadm info --query=all --path=/devices/pci0000:00/0000:00:1d.1/usb6/6-1
- 代碼: 選擇全部
P: /devices/pci0000:00/0000:00:1d.1/usb6/6-1
N: bus/usb/006/007
S: char/189:646
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb6/6-1
E: MAJOR=189
E: MINOR=646
E: DEVNAME=/dev/bus/usb/006/007
E: DEVTYPE=usb_device
E: DRIVER=usb
E: DEVICE=/proc/bus/usb/006/007
E: PRODUCT=408/1000/0
E: TYPE=0/0/0
E: BUSNUM=006
E: DEVNUM=007
E: SUBSYSTEM=usb
E: ID_VENDOR=Qualcomm__Incorporated
E: ID_VENDOR_ENC=Qualcomm\x2c\x20Incorporated
E: ID_VENDOR_ID=0408
E: ID_MODEL=USB_MMC_Storage
E: ID_MODEL_ENC=USB\x20MMC\x20Storage
E: ID_MODEL_ID=1000
E: ID_REVISION=0000
E: ID_SERIAL=Qualcomm__Incorporated_USB_MMC_Storage_000000000002
E: ID_SERIAL_SHORT=000000000002
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: DEVLINKS=/dev/char/189:646