linux - how to run a shell script when pull out usb device with udev -


this rule:

env{devtype}=="usb_device",  action=="remove",  subsystem=="usb",  attr{idvendor}=="8829",  attr{idproduct}=="0010",  run+="/bin/mkdir /home/zkd/123" 

it doesn't work. rule:

env{devtype}=="usb_device",  action=="remove",  subsystem=="usb",  run+="/bin/mkdir /home/zkd/123" 

it works!! , works:

env{devtype}=="usb_device",  action=="add",  subsystem=="usb",  attr{idvendor}=="8829",  attr{idproduct}=="0010",  run+="/bin/mkdir /home/zkd/123" 

so how run shell script when pull out usb device udev. must recognize usb device idproduct , idvendor. thank answer!

information removed devices passed in env rather in attr since there's no longer device extract information from.

env{devtype}=="usb_device",  action=="remove",  subsystem=="usb",  env{idvendor}=="8829",  env{idproduct}=="0010",  run+="/bin/mkdir /home/zkd/123" 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -