imx6 电容屏参数更改

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=0100
N: Name="gpio-keys"
P: Phys=gpio-keys/input0
S: Sysfs=/devices/platform/gpio-keys/input/input0
U: Uniq=
H: Handlers=kbd event0 
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="AR1020 Touchscreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=cpufreq_interactive mouse0 event1 
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: 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."
event1

sed -n    : 不输出到终端
sed '16p' : 打印第16行
grep -o   : only match
原文地址:https://www.cnblogs.com/helloworldtoyou/p/5505916.html