
我正在編寫一個使用 ID_PATH 的 udev 規則,只是為了使裝置在其插入的連接埠上保持不變。
這就是我所擁有的
KERNEL=="ttyUSB?",SUBSYSTEM=="tty",ENV{ID_BUS}=="usb",ENV{ID_PATH}=="pci-0000:00:12.0-usb-0:1:1.0",SYMLINK="bla"
最初,該檔案名為 52-foo.rules,但它不起作用。我將其重命名為 81-foo.rules 並且工作正常。
就像 ENV{} 值僅在數字夠大時才有效。有人可以解釋為什麼會出現這種情況嗎?
謝謝,
答案1
也許您的規則正在被另一條規則覆蓋。由於編號較高的規則最後運行,因此當您使用較高編號時,它不會被覆蓋。
< 60 most user rules; if you want to prevent an assignment being
overriden by default rules, use the := operator.
these cannot access persistent information such as that from
vol_id
< 70 rules that run helpers such as vol_id to populate the udev db
< 90 rules that run other programs (often using information in the
udev db)
>=90 rules that should run last
查看這