Question about simulating a MT device with evemu-event

input-tools at storiepvtride.it input-tools at storiepvtride.it
Sun Nov 29 23:13:55 UTC 2020


Hello,

I'm trying to programmatically simulate the input of Lenovo Thinkpad
touchpad, identified as:

# libinput list-devices
Device:           Synaptics TM3276-022
Kernel:           /dev/input/event6
Group:            11
Seat:             seat0, default
Size:             97x65mm
Capabilities:     pointer gesture
Tap-to-click:     disabled
Tap-and-drag:     enabled
Tap drag lock:    disabled
Left-handed:      disabled
Nat.scrolling:    disabled
Middle emulation: disabled
Calibration:      n/a
Scroll methods:   *two-finger edge
Click methods:    *button-areas clickfinger
Disable-w-typing: enabled
Accel profiles:   none
Rotation:         n/a

I can record and replay events with:

# libinput record --show-keycodes /dev/input/event6
--output-file=touchpad.yml
# libinput replay touchpad.yml

By looking at the events generated I'm naively trying to mimick this
 block:

- [  0,   0,   3,  57,   6506] # EV_ABS / ABS_MT_TRACKING_ID     6506
- [  0,   0,   3,  53,   1434] # EV_ABS / ABS_MT_POSITION_X      1434
- [  0,   0,   3,  54,    836] # EV_ABS / ABS_MT_POSITION_Y       836
- [  0,   0,   3,  52,      1] # EV_ABS / ABS_MT_ORIENTATION        1
- [  0,   0,   3,  58,     37] # EV_ABS / ABS_MT_PRESSURE          37
- [  0,   0,   3,  49,      0] # EV_ABS / ABS_MT_TOUCH_MINOR        0
- [  0,   0,   1, 330,      1] # EV_KEY / BTN_TOUCH                 1
- [  0,   0,   1, 325,      1] # EV_KEY / BTN_TOOL_FINGER           1
- [  0,   0,   3,   0,   1434] # EV_ABS / ABS_X                  1434
- [  0,   0,   3,   1,    836] # EV_ABS / ABS_Y                   836
- [  0,   0,   3,  24,     37] # EV_ABS / ABS_PRESSURE             37
- [  0,   0,   0,   0,      0] # ------------ SYN_REPORT (0) ---------- +0ms

with a script that chains a series of evemu-event calls:

function send_event() {
    type=$1; code=$2; value=$3
    evemu-event /dev/input/event6 --type ${type} --code ${code} --value ${value}
}

send_event EV_ABS  ABS_MT_TRACKING_ID     6506
send_event EV_ABS  ABS_MT_POSITION_X      1434
send_event EV_ABS  ABS_MT_POSITION_Y       836
send_event EV_ABS  ABS_MT_ORIENTATION        1
send_event EV_ABS  ABS_MT_PRESSURE          37
send_event EV_ABS  ABS_MT_TOUCH_MINOR        0
send_event EV_KEY  BTN_TOUCH                 1
send_event EV_KEY  BTN_TOOL_FINGER           1
send_event EV_ABS  ABS_X                  1434
send_event EV_ABS  ABS_Y                   836
# the final event with a sync
evemu-event /dev/input/event6 --sync --type EV_ABS --code ABS_MT_PRESSURE --value 37

I observe the traffic, but I see nothing happening. The desired
result would be something like when I actually using the touchpad:

# libinput debug-events
 event5   POINTER_MOTION    +4.08s       -4.74/  0.00 ( -9.00/ +0.00)
 event5   POINTER_MOTION    +4.09s       -4.74/  0.00 ( -9.00/ +0.00)
 event5   POINTER_MOTION    +4.09s       -4.21/  0.53 ( -8.00/ +1.00)
 event5   POINTER_MOTION    +4.10s       -3.68/  1.05 ( -7.00/ +2.00)
 ...

I can successfully simulate an external keyboard, for example with:

evemu-event /dev/input/event16 --sync --type EV_KEY --code KEY_PAGEDOWN --value 1
evemu-event /dev/input/event16 --sync --type EV_KEY --code KEY_PAGEDOWN --value 0

Obviously I'm a newbie and a bit confused on how to make all this work,
I'd appreciate a bit of light on the matter :-)

regards,


More information about the Input-tools mailing list