Open makeevolution opened 3 years ago
With "by default", I think they mean that when creating a device, they say to support Keyboard events since it's the most common use case. Evdev devices usually specify all the keys they'll ever send beforehand to allow other programs to classify them by. You can simply specify your own events=
.
Here is an example I did that basically proxied Wacom touch events from an embedded device to a host computer: https://github.com/LinusCDE/rmTabletDriver/blob/738294772d613ab42478db98ded2faf3d68f8c47/tabletDriver.py#L43
I don't think that such a thing as a "swipe" event exists within evdev. You probably need to fake the swipe by sending the fitting touch events. You should also consider what type of "touch events" you want to send.
REL_*
)ABS_MT_
. You should also specify the AbsInfo since the touch screen size rarely matches the screen resolution (my example above does it as well). Not all multitouch screns have the same event behaviour.ABS_
. They also use some BTN_*
events to denote when the pen gets in reach or the "rubber side/tool" is used.The best thing is probably to look at the emitted events of the device type you want to fake (using evtest). Mutitouch (MT) for example usually increases the ABS_MT_TRACKING_ID
and keeps track of fingers by changing the ABS_MT_SLOT
before each X, Y coordinate events.
Here are some example codes uses for the reMarkable tablet (an embedded eink device aimed at notetaking). The marked lines are a typical Multitouch screen (like on smartphones). The codes and names should match with the ecodes of python-evdev. https://github.com/canselcik/libremarkable/blob/master/src/input/ecodes.rs#L13-L21
I saw in the injecting input section of the documentation that the library "accepts only KEY_* events by default". Does this mean I cannot inject touch events (like touching, swiping, etc.), and if I am wrong, how would I go about injecting such an touch event?