imx6使用电容屏时需要获取对应的usb的event。其中用到了shell的一些命令。分析如下。# inputCheckLine=`cat /proc/bus/input/devices | grep -n "Vendor=0eef" | grep "Product=0020 Version=0001"| awk -F: '{print $1}'`# touchEvent=`sed -n "$((${inputCheckLine}+5))p" /proc/bus/input/devices | grep -o "event."` inputCheckLine=`cat /proc/bus/input/devices | grep -n "AR1020 Touchscreen" | awk -F: '{print $1}'` touchEvent=`sed -n "$((${inputCheckLine}+4))p" /proc/bus/input/devices | grep -o "event."`root@freescale ~$ cat /proc/bus/input/devices I: Bus=0019 Vendor=0001 Product=0001 Version=0100N: Name="gpio-keys"P: Phys=gpio-keys/input0S: Sysfs=/devices/platform/gpio-keys/input/input0U: Uniq=H: Handlers=kbd event0 B: PROP=0B: EV=3B: KEY=100000 0 0 0I: Bus=0000 Vendor=0000 Product=0000 Version=0000N: Name="AR1020 Touchscreen"P: Phys=S: Sysfs=/devices/virtual/input/input1U: Uniq=H: Handlers=cpufreq_interactive mouse0 event1 B: PROP=0B: EV=bB: KEY=400 0 0 0 0 0 0 0 0 0 0B: ABS=3......grep -n匹配并打印行号root@freescale ~$ cat /proc/bus/input/devices | grep -n "AR1020 Touchscreen"12:N: Name="AR1020 Touchscreen"这样获得了AR1020 Touchscreen所在的行。所需要的event1在16行root@freescale ~$ sed -n "16p" /proc/bus/input/devices H: Handlers=cpufreq_interactive mouse0 event1 root@freescale ~$ sed -n "16p" /proc/bus/input/devices | grep -o "event."event1sed -n : 不输出到终端sed '16p' : 打印第16行grep -o : only match