I.MX6 linux eGalaxTouch 自动获取设备节点

时间:2020-12-26 09:21:41
                       I.MX6 linux eGalaxTouch 自动获取设备节点


\\\\\\\\\\\\\\
-*- 目录 -*-/////////////
| 一. 需求:
| 二. /proc/bus/input/devices 内容:
| 三. 解决方法:
| 四. 实际应用:
--------------------------------------

一. 需求:
获取eGalaxTouch的输入设备节点

二.
/proc/bus/input/devices 内容:
root@freescale
/proc/bus/input$ 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
=0003 Vendor=0eef Product=7201 Version=0210
N: Name
="eGalax Inc. eGalaxTouch EXC7200-0031v1000"
P: Phys
=usb-fsl-ehci.1-1.3/input0
S: Sysfs
=/devices/platform/fsl-ehci.1/usb2/2-1/2-1.3/2-1.3:1.0/input/input1
U: Uniq
=
H: Handlers
=cpufreq_interactive
B: PROP
=0
B: EV
=1b
B: KEY
=421 0 30001 0 0 0 0 0 0 0 0
B: ABS
=100 3f
B: MSC
=10

I: Bus
=0006 Vendor=0eef Product=0020 Version=0001
N: Name
="eGalaxTouch Virtual Device for Multi"
P: Phys
=
S: Sysfs
=/devices/virtual/input/input2
U: Uniq
=
H: Handlers
=cpufreq_interactive event1
B: PROP
=2
B: EV
=b
B: KEY
=400 0 0 0 0 0 0 0 0 0 0
B: ABS
=6608000 1000003

I: Bus
=0006 Vendor=0eef Product=0010 Version=0001
N: Name
="eGalaxTouch Virtual Device for Single"
P: Phys
=
S: Sysfs
=/devices/virtual/input/input3
U: Uniq
=
H: Handlers
=event2
B: PROP
=2
B: EV
=b
B: KEY
=30000 0 0 0 0 0 0 0 0
B: ABS
=3

root@freescale
/proc/bus/input$

三. 解决方法:
1. 采用shell脚本的进行解决;
2. 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."`

四. 实际应用:
......
while [ -z $touchEvent ]
do
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."`
echo
"please hang up USB TOUCH !"
usleep
10
done
......
export TSLIB_TSDEVICE
=/dev/input/${touchEvent}
export QWS_MOUSE_PROTO
=tslib:/dev/input/${touchEvent}
......