代码: 全选
# MediaTek MT6276M and others, MediaTek/Medion S4222 and probably others
ATTR{idVendor}=="0e8d", ATTR{idProduct}=="0002", RUN+="usb_modeswitch '/%k'"
#ATTR{idVendor}=="0e8d", ATTR{idProduct}=="0002", RUN+="/home/user/test/test.sh '/%k'"
但换成usb_modeswitch 就是类似下面的内容:
代码: 全选
-j -Q -b 4 -g 15 -v 0e8d -p 0002
-Q -D -b 4 -g 15 -v 0e8d -p 0002 -f # MediaTek MT6276M and others TargetVendor=0x0e8d TargetProductList="00a1,00a2,00a5" MessageContent="555342431234567800000000000006f0010300000000000000000000000000"
代码: 全选
#!/bin/sh
echo $* >>/usblog
Sun Nov 12 00:26:17 CST 2017补充:
原来那个是/lib/udev/usb_modeswitch,并非PATH变量路径里的usb_modeswitch.
man udev:
RUN{type}
Add a program to the list of programs to be executed after processing all the rules for a specific event, depending on "type":
"program"
Execute an external program specified as the assigned value. If no absolute path is given, the program is expected to live in /lib/udev; otherwise, the
absolute path must be specified.
This is the default if no type is specified.