T113 触摸适配

USB I2C

Posted by LXG on November 3, 2023

查看所有输入设备


sh-4.4# cat /proc/bus/input/devices

物理按键ADC
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sunxi-keyboard"
P: Phys=sunxikbd/input0
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=kbd event0 
B: PROP=0
B: EV=3
B: KEY=1000 800 c0000 0 0 10000000

电阻屏幕
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="2009c00.rtp"
P: Phys=sun4i_ts/input0
S: Sysfs=/devices/platform/soc@3000000/2009c00.rtp/input/input1
U: Uniq=
H: Handlers=event1 
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=3

高精度数模转换模块
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="sunxi-gpadc0"
P: Phys=sunxigpadc0/input0
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: PROP=0
B: EV=100003
B: KEY=200000 0 0 0 0 0 0 0 8c0000 0 0 10000000

GPIO 输入事件
I: Bus=0019 Vendor=0001 Product=0001 Version=0100
N: Name="gpio_event"
P: Phys=gpio_event/input1
S: Sysfs=/devices/platform/rp_power/input/input3
U: Uniq=
H: Handlers=event3 
B: PROP=0
B: EV=1

麦克风输入事件
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="audiocodec sunxi Audio Jack"
P: Phys=ALSA
S: Sysfs=/devices/platform/soc@3000000/2030340.sound/sound/card0/input4
U: Uniq=
H: Handlers=kbd event4 
B: PROP=0
B: EV=23
B: KEY=40 0 0 0 0 0 0 0 0 0 0 4 0 0 0 c0000 0 0 0
B: SW=14

USB鼠标
I: Bus=0003 Vendor=0000 Product=3825 Version=0111
N: Name=" USB OPTICAL MOUSE"
P: Phys=usb-sunxi-ehci-1.2/input0
S: Sysfs=/devices/platform/soc@3000000/4200000.ehci1-controller/usb1/1-1/1-1.2/1-1.2:1.0/0003:0000:3825.0001/input/input5
U: Uniq=
H: Handlers=event5 
B: PROP=0
B: EV=17
B: KEY=70000 0 0 0 0 0 0 0 0
B: REL=903
B: MSC=10

电容屏触摸
I: Bus=0003 Vendor=222a Product=0001 Version=0110
N: Name="ILITEK ILITEK-TP Touchscreen"
P: Phys=usb-sunxi-ehci-1.3/input0
S: Sysfs=/devices/platform/soc@3000000/4200000.ehci1-controller/usb1/1-1/1-1.3/1-1.3:1.0/0003:222A:0001.0002/input/input6
U: Uniq=
H: Handlers=event6 
B: PROP=0
B: EV=1b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=100 3
B: MSC=10

I: Bus=0003 Vendor=222a Product=0001 Version=0110
N: Name="ILITEK ILITEK-TP Mouse"
P: Phys=usb-sunxi-ehci-1.3/input0
S: Sysfs=/devices/platform/soc@3000000/4200000.ehci1-controller/usb1/1-1/1-1.3/1-1.3:1.0/0003:222A:0001.0002/input/input8
U: Uniq=
H: Handlers=event7 
B: PROP=0
B: EV=1b
B: KEY=1f0000 0 0 0 0 0 0 0 0
B: ABS=3
B: MSC=10

查看输入设备-2


sh-4.4# ls -al dev/input/*
crw-rw----    1 root     root       13,  64 Jan  1 00:00 dev/input/event0
crw-rw----    1 root     root       13,  65 Jan  1 00:00 dev/input/event1
crw-rw----    1 root     root       13,  66 Jan  1 00:00 dev/input/event2
crw-rw----    1 root     root       13,  67 Jan  1 00:00 dev/input/event3
crw-rw----    1 root     root       13,  68 Jan  1 00:00 dev/input/event4
crw-rw----    1 root     root       13,  69 Jan  1 00:00 dev/input/event5
crw-------    1 root     root       13,  70 Jan  1 00:00 dev/input/event6
crw-------    1 root     root       13,  71 Jan  1 00:00 dev/input/event7

dev/input/by-id:
total 0
drwxr-xr-x    2 root     root           100 Jan  1 00:00 .
drwxr-xr-x    4 root     root           240 Jan  1 00:00 ..
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 usb-0000_USB_OPTICAL_MOUSE-event-mouse -> ../event5
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 usb-ILITEK_ILITEK-TP-event-if00 -> ../event6
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 usb-ILITEK_ILITEK-TP-event-mouse -> ../event7

dev/input/by-path:
total 0
drwxr-xr-x    2 root     root           160 Jan  1 00:00 .
drwxr-xr-x    4 root     root           240 Jan  1 00:00 ..
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 platform-2009c00.rtp-event -> ../event1
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 platform-2030340.sound-event -> ../event4
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 platform-4200000.ehci1-controller-usb-0:1.2:1.0-event-mouse -> ../event5
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 platform-4200000.ehci1-controller-usb-0:1.3:1.0-event -> ../event6
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 platform-4200000.ehci1-controller-usb-0:1.3:1.0-event-mouse -> ../event7
lrwxrwxrwx    1 root     root             9 Jan  1 00:00 platform-rp_power-event -> ../event3

查看输入事件


sh-4.4# hexdump dev/input/event6
0000000 01ef 0000 cb47 0009 0004 0004 0042 000d
0000010 01ef 0000 cb47 0009 0001 014a 0001 0000
0000020 01ef 0000 cb47 0009 0003 0000 1a31 0000
0000030 01ef 0000 cb47 0009 0003 0001 1990 0000
0000040 01ef 0000 cb47 0009 0000 0000 0000 0000
0000050 01ef 0000 b199 000a 0003 0000 1a2a 0000

QT 环境变量


if [ -d $QTDIR ];then

        export  QT_ROOT=$QTDIR
        export  PATH=$QTDIR/bin:$PATH
        export  LD_LIBRARY_PATH=$QTDIR/lib:/usr/lib/cedarx/:$LD_LIBRARY_PATH

        export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
        export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
        export QT_QPA_FONTDIR=$QT_ROOT/fonts

	#TouchDevice=gt9xxnew_ts
	for InputDevices in /sys/class/input/input*
	do
		DeviceName=`cat $InputDevices/name`
	        # USB ILITEK
		if [ $DeviceName == "ILITEK ILITEK-TP" ];then
		   TouchDeviceNum=${InputDevices##*input}
		   export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event$TouchDeviceNum
		   echo "add "/dev/input/event$TouchDeviceNum "to Qt Application."
		   break
		fi
                # I2C Goodix
		if [ $DeviceName == "gt9xxnew_ts" ];then
		   TouchDeviceNum=${InputDevices##*input}
		   export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event$TouchDeviceNum
		   echo "add "/dev/input/event$TouchDeviceNum "to Qt Application."
		   break
		fi
	done

        export QT_QPA_PLATFORM=eglfs
        export QT_QPA_GENERIC_PLUGINS=evdevtouch
        export QT_QPA_EGLFS_INTEGRATION=eglfs_mali
        #export QT_QPA_FB_HIDECURSOR=1
        #export QT_QPA_EGLFS_HIDECURSOR=1
        #export QT_QPA_EGLFS_ROTATION=90

        export QWS_MOUSE_PROTO=
        export DBUS_SESSION_BUS_ADDRESS=`cat /tmp/dbusaddr`
        mkdir -p /dev/shm
        ulimit -c unlimited
        #debug Launcher &
        debug MediaUI &
        echo "find qt5 installed done"
fi

驱动源码

多点触摸

kernel/linux-5.4/drivers/hid/hid-multitouch.c

单点触摸

汇顶I2C触摸


kernel/linux-5.4/drivers/input/touchscreen/gt9xxnew$ tree
.
├── goodix_tool.c
├── gt9xx.c
├── gt9xxdup.c
├── GT9XXF Firmware Headers
│   ├── GT910
│   │   └── gt9xx_firmware.h
│   ├── GT9150
│   │   └── gt9xx_firmware.h
│   ├── GT950
│   │   └── gt9xx_firmware.h
│   ├── GT960F
│   │   └── gt9xx_firmware.h
│   ├── GT963
│   │   └── gt9xx_firmware.h
│   ├── GT968F
│   │   └── gt9xx_firmware.h
│   └── readme.txt
├── gt9xx_firmware.h
├── gt9xx.h
├── gt9xx_update.c
├── Kconfig
└── Makefile

修改QT触摸方向

export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event$TouchDeviceNum:rotate=90