开发者

how to send command line arguments to a process through udev?

开发者 https://www.devze.com 2023-03-05 01:05 出处:网络
On detection of a USB device I\'m trying to have udev start up a process and pass the serial number of the USB device as an argument to the process.

On detection of a USB device I'm trying to have udev start up a process and pass the serial number of the USB device as an argument to the process.

file:/etc/udev/rules.d/10-FTDI2232H-usb.rules

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR开发者_C百科{idProduct}=="6010", RUN+="/opt/usbprog %s" ATTR{serial}

I'm not to sure if the printf style arguments is how this supposed to be accomplished. Any help would be greatly appreciated.


Ah...I finally figured it out.

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", RUN+="/opt/usbprog %s{serial}", $ATTR{serial}

0

精彩评论

暂无评论...
验证码 换一张
取 消