I am trying to write touch events. I am using a camera to track hands so I need two pointers and I need to display them.
This is what I have tried but it does nothing:
import uinput
import time
device = uinput.Device([
uinput.BTN_TOUCH,
uinput.BTN_TOOL_PEN,
# uinput.INPUT_PROP_POINTER, # This property doesn't exist... what is the alternative?
uinput.ABS_X,
uinput.ABS_Y,
])
time.sleep(1)
device.emit(uinput.ABS_X, 5)
device.emit(uinput.ABS_Y, 5)
device.emit(uinput.BTN_TOUCH, 1)
for i in range(20):
time.sleep(0.01)
device.emit(uinput.ABS_Y, 5 * i)
device.emit(uinput.BTN_TOUCH, 0)
However, using a mouse works:
import uinput
import time
device = uinput.Device([
uinput.BTN_LEFT,
uinput.BTN_RIGHT,
uinput.REL_X,
uinput.REL_Y,
])
time.sleep(1)
for i in range(20):
time.sleep(0.01)
device.emit(uinput.REL_Y, 5)
But I need absolute rather than relative positioning.
Is it possible for me to see events from the terminal for debugging?
I want to be able to have 2 pointers, absolute positioning, touch/click, hover(BTN_TOOL_PEN) and my intention is to allow drag/scrolling. Any guidance as to what events I should be using and a simple working example would be great!
I could not get evdev working but answers for that are welcome too.