Plan 9: Multi-touch Touchpad


Multi-touch Gestures (pinch, swipe and rotate) demo.


Synopsys DesignWare I²C on Intel LPSS (Alder Lake)

The touchpad is connected through the Intel LPSS (Low Power Subsystem) I²C controller, which uses Synopsys DesignWare I²C IP.

The following output demonstrates touch events being decoded and generated in userspace.

n indicates the number of fingers reported by the touchpad.

touch conf 1 tip 1 id 0 x 1377 y 1129 scan 13523 n 1 btn 0
touch conf 1 tip 1 id 0 x 1377 y 1129 scan 13691 n 1 btn 0
touch conf 1 tip 1 id 0 x 1377 y 1129 scan 14675 n 1 btn 0
touch conf 1 tip 1 id 0 x 1378 y 1129 scan 15659 n 1 btn 0
touch conf 1 tip 1 id 0 x 1381 y 1130 scan 16643 n 1 btn 0
touch conf 1 tip 1 id 0 x 1383 y 1131 scan 17627 n 1 btn 0
touch conf 1 tip 1 id 0 x 1386 y 1132 scan 18611 n 1 btn 0
touch conf 1 tip 0 id 0 x 1386 y 1132 scan 19599 n 1 btn 0
touch conf 1 tip 1 id 0 x 1580 y 1192 scan 34460 n 2 btn 0
touch conf 1 tip 1 id 0 x 1580 y 1192 scan 35343 n 2 btn 0
touch conf 1 tip 1 id 0 x 1580 y 1192 scan 36331 n 2 btn 0
touch conf 1 tip 1 id 0 x 1580 y 1192 scan 37320 n 2 btn 0
touch conf 1 tip 1 id 0 x 1580 y 1192 scan 38309 n 2 btn 0
touch conf 1 tip 1 id 0 x 1580 y 1192 scan 39298 n 2 btn 0
touch conf 1 tip 0 id 0 x 1580 y 1192 scan 40287 n 2 btn 0
touch conf 1 tip 1 id 0 x 1868 y 617 scan 52281 n 3 btn 0
touch conf 1 tip 1 id 0 x 1868 y 617 scan 53083 n 3 btn 0
touch conf 1 tip 1 id 0 x 1868 y 617 scan 54072 n 3 btn 0
touch conf 1 tip 1 id 0 x 1868 y 617 scan 55061 n 3 btn 0
touch conf 1 tip 1 id 0 x 1868 y 617 scan 56049 n 3 btn 0
touch conf 1 tip 1 id 0 x 1868 y 617 scan 57037 n 3 btn 0
touch conf 1 tip 0 id 0 x 1868 y 617 scan 58025 n 3 btn 0
 

 

Useful Tools

Identify the device. Bus=0011 is PS/2 (i8042) and Bus=0018 is I2C

cat /proc/bus/input/devices
I: Bus=0018 Vendor=093a Product=2010 Version=0100
N: Name="ASUP1301:00 093A:2010 Mouse"
P: Phys=i2c-ASUP1301:00
S: Sysfs=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ASUP1301:00/0018:093A:2010.000B/input/input32
U: Uniq=
H: Handlers=mouse1 event4 
B: PROP=0
B: EV=17
B: KEY=30000 0 0 0 0
B: REL=903
B: MSC=10

I: Bus=0018 Vendor=093a Product=2010 Version=0100
N: Name="ASUP1301:00 093A:2010 Touchpad"
P: Phys=i2c-ASUP1301:00
S: Sysfs=/devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-2/i2c-ASUP1301:00/0018:093A:2010.000B/input/input33
U: Uniq=
H: Handlers=mouse2 event15 
B: PROP=5
B: EV=1b
B: KEY=e520 10000 0 0 0 0
B: ABS=2e0800000000003
B: MSC=20
 


iasl - ACPI Source Language compiler/decompiler

sudo apt install acpica-tools 
mkdir acpi && cd acpi
sudo cp /sys/firmware/acpi/tables/DSDT /sys/firmware/acpi/tables/SSDT* .
iasl -d DSDT SSDT*
grep -n ASUP1301 *.dsl

Case (0x08)
                        {
                            _HID = "ASUP1301"
                            HID2 = One
                            BADR = 0x15
                            SPED = 0x00061A80
                            Return (Zero)
                        }
 


Lessons Learnt

  1. 2-Finger swipe is a scroll.
  2. If you're doing the trackpad driver development on a laptop, you need a USB mouse.
  3. For Alder Lake, you need to passthrough both I2C controllers 0 and 1 and.
  4. You can generate fake mouse events via /dev/mousein. 

 

Files

/sys/src/9/port/devi2c.c

/sys/src/9/port/i2cdw.c (Add the following to kernel config link section)

    i2cdw        pci devi2c 

/sys/src/cmd/aux/hidi2c.c (Userland tool for generating the events) 

/sys/src/cmd/aux/gesturedemo.c 

/sys/src/9/port/i2cfake.c (Fake i2c implementation for testing devi2c. Presents '#J/fake0')

 

Code

 

References

  1. PCI passthrough setup for QEMU 

 

 

Comments

Popular posts from this blog

Plan 9 : The Infinity Notebook

Plan 9: Quick Boot with UEFI

Plan 9: Key Visualizer