x, y in struct _SynapticsSHM is ABS_X, ABS_Y, why not ABS_MT_POSITION_X, ABS_MT_POSITION_Y?

Leslie Zhai xiangzhai83 at gmail.com
Wed Jan 15 17:31:14 PST 2014


Hi Peter,

You are so nice to answer all my questions, if you came to China for 
travel, I will provide HOST, courchsurfing.org, for you :)

Yes, device node does not change if changed vts, sorry for my poor 
English :P
But you still understand what I want, LOL, I will try GrabEventDevice 
"off" option, and directly read device fd.

Regards,
Leslie

> On Wed, Jan 15, 2014 at 05:43:31PM +0800, Leslie Zhai wrote:
>> Hi Peter,
>>
>> I am debugging geis-2.2.16 these days, and also read about synaptics
>> 1.7.x source code, in 1.7.x, it uses xf86PostTouchEvent, post
>> multitouch event to X, then the client application, such as
>> touchegg, is able to get XEvent in a while loop, is that right?
> as said in the other email, I don't know much about geis and synaptics only
> posts touch events in certain configurations.
>   
>> But in 1.7.x src/eventcomm.c, about the 576 line, it still treats
>> ABS_MT_POSITION_X as cumulative_dx, and I read about your
>> libtouchpad source code hosting on github src/touchpad-events.c,
>> about the 42 line, it correctly treats ABS_MT_POSITION_X as x.
>>
>> Take Linux multitouch protocol type B for example,
>>
>> ABS_MT_SLOT 0
>> ABS_MT_TRACKING_ID 45
>> ABS_MT_POSITION_X x[0]
>> ABS_MT_POSITION_Y y[0]
>> ABS_MT_SLOT 1
>> ABS_MT_TRACKING_ID 46
>> ABS_MT_POSITION_X x[1]
>> ABS_MT_POSITION_Y y[1]
>> SYN_REPORT
>>
>> During a SYN_REPORT period, there are might several
>> (ABS_MT_POSITION_X, ABS_MT_POSITION_Y) 2D points to indicate the
>> positions where multi-fingers touched, but synaptics 1.7.x only
>> maintain 1 (ABS_MT_POSITION_X, ABS_MT_POSITION_Y) point, it might
>> lost other multitouch points.
> yes, I'm aware of all this - synaptics just doesn't have the code, it's too
> old and never got updated properly for a multitude of reasons.
>
>> It is able to switch to tty2, because synaptics process used device
>> file descriptor, run evtest /dev/input/eventX to print_absdata, and
>> I have no idea how to directly read the device fd under tty7, such
>> as gnome shell, kde, sort of DE... thanks a lot :)
> I don't know what the question is here, sorry. the device node doesn't
> change if you change vts, it's always /dev/input/eventX.
>
> you may be running into the issue that synaptics calls an EVIOCGRAB on the
> device, hence you won't see events on the device while the synaptics driver
> is active. there's a GrabEventDevice "off" option that helps with that.
>
> Cheers,
>     Peter
>
>>> On Wed, Jan 08, 2014 at 09:28:29PM +0800, Zhai Xiang wrote:
>>>> Hi Peter,
>>>>
>>>> Sorry for my late reply because I wen to Beijing for a short business
>>>> travel.
>>>>
>>>> Yes, I read about the source code about 1.7.x by apt-get source
>>>> xserver-xorg-input-synaptics under Linux Deepin 2014, the SHM has been
>>>> completely removed.
>>> generally I recommend looking at the git sources before you hack on any
>>> software project, much more likely to be up-to-date than the package a
>>> distribution ships.
>>>
>>>> And I do not want to hack the 1.6.x source code under Linux Deepin 2013 to
>>>> support ABS_MT_SLOT, ABS_MT_POSITION_X && ABS_MT_POSITION_Y sort of
>>>> multitouch support, even it supports multitouch and gesture recognition,
>>>> such as 2 fingers to zoom out/in, 4 fingers swipe up to show all open
>>>> windows, 4 fingers swipe right to switch to 2nd work space, 4 fingers swipe
>>>> left to switch to 1st work space, 3 fingers to move active window, the demo
>>>> video shown as http://v.youku.com/v_show/id_XNjU5MTk4MTk2.html
>>>>
>>>> You said you are writing the driver with multitouch support using a
>>>> different base design, can I ask whether or not the driver`s source code
>>>> will be accepted by xorg official maintainer?
>>> well, given that I'm the input maintainer I'm gonna say "yes" :)
>>>
>>>> Would it be OK for you if I also contribute to your driver? If it is OK,
>>>> may I have your driver source code version control link such as github or
>>>> something else?
>>> it's called libinput but currently spread across some personal github
>>> repositories. it'll be on freedesktop soon, but it's still very early
>>> stages with a lot of the top-level work to be sorted out first so it's a bit
>>> too early to go full volume on hacking on it. I've got an experimental
>>> driver in https://github.com/whot/libtouchpad which is a test-bed for a
>>> couple of things that I'll move over to libinput eventually.
>>>
>>> Cheers,
>>>     Peter
>>>
>>>> 2014/1/6 Peter Hutterer <peter.hutterer at who-t.net>
>>>>
>>>>> On Sat, Jan 04, 2014 at 04:25:51PM +0800, Leslie Zhai wrote:
>>>>>> Hi xorg developers,
>>>>>>
>>>>>> in xserver-xorg-input-synaptics-1.6.2/include/synaptics.h
>>>>>> the struct _SynapticsSHM is shown as below:
>>>>> SHM has been completely removed in synaptics 1.7, it's largely a leftover
>>>> >from before device properties where it was needed for run-time
>>>>> configuration. it had't been updated in a while, so any code that deals
>>>>> with
>>>>> it is likely outdated.
>>>>>
>>>>> updating synaptics to support multitouch properly is a bit of a larger
>>>>> issue, it's likely easier to write the driver from scratch using a
>>>>> different
>>>>> base design (which I'm currently in the process of doing).
>>>>>
>>>>> Cheers,
>>>>>     Peter
>>>>>
>>>>>> ```
>>>>>> typedef struct _SynapticsSHM {
>>>>>> int version; /* Driver version */
>>>>>>
>>>>>> /* Current device state */
>>>>>> int x, y; /* actual x, y coordinates */
>>>>>> int z; /* pressure value */
>>>>>> int numFingers; /* number of fingers */
>>>>>> int fingerWidth; /* finger width value */
>>>>>> int left, right, up, down; /* left/right/up/down buttons */
>>>>>> Bool multi[8];
>>>>>> Bool middle;
>>>>>> } SynapticsSHM;
>>>>>> ```
>>>>>>
>>>>>> there are x and y, because I want to know what they are, then read about
>>>>>> src/eventcomm.c
>>>>>> ```
>>>>>> if (ev.code < ABS_MT_SLOT) {
>>>>>> switch (ev.code) {
>>>>>> case ABS_X:
>>>>>> hw->x = apply_st_scaling(proto_data, ev.value, 0);
>>>>>> break;
>>>>>> case ABS_Y:
>>>>>> hw->y = apply_st_scaling(proto_data, ev.value, 1);
>>>>>> break;
>>>>>> case ABS_PRESSURE:
>>>>>> hw->z = ev.value;
>>>>>> break;
>>>>>> case ABS_TOOL_WIDTH:
>>>>>> hw->fingerWidth = ev.value;
>>>>>> break;
>>>>>> }
>>>>>> }
>>>>>> ```
>>>>>>
>>>>>> Why use ABS_X for hw->x?
>>>>>> I want to recognize multi-touch gesture, such as zoom in/out, with
>>>>>> ABS_MT_SLOT, ABS_MT_POSITION_X and ABS_MT_POSITION_Y based on Linux
>>>>>> Multi-touch (MT) Protocol.
>>>>>> But struct _SynapticsSHM only provides ABS_X and ABS_Y, even there is
>>>>>> numFingers, it is still unable to distinguish which finger touching the
>>>>>> point1, point2 or pointN...
>>>>>>
>>>>>> So I hacked the struct _SynapticsSHM, added int slot, mt_x, mt_y, shown
>>>>>> as below:
>>>>>> ```
>>>>>> typedef struct _SynapticsSHM {
>>>>>> int version; /* Driver version */
>>>>>>
>>>>>> /* Current device state */
>>>>>> int x, y; /* actual x, y coordinates */
>>>>>> int z; /* pressure value */
>>>>>> int numFingers; /* number of fingers */
>>>>>> int fingerWidth; /* finger width value */
>>>>>> int left, right, up, down; /* left/right/up/down buttons */
>>>>>> Bool multi[8];
>>>>>> Bool middle;
>>>>>>
>>>>>> int slot;
>>>>>> int mt_x;
>>>>>> int mt_y;
>>>>>> } SynapticsSHM;
>>>>>> ```
>>>>>>
>>>>>> and also hacked src/eventcomm.c, using ABS_MT_POSITION_X for mt_x, shown
>>>>>> as below:
>>>>>> ```
>>>>>> case EV_ABS:
>>>>>> if (ev.code == ABS_MT_SLOT)
>>>>>> hw->slot = ev.value;
>>>>>> if (ev.code == ABS_MT_POSITION_X)
>>>>>> hw->mt_x = ev.value;
>>>>>> if (ev.code == ABS_MT_POSITION_Y)
>>>>>> hw->mt_y = ev.value;
>>>>>> ```
>>>>>>
>>>>>> Then I can use slot, mt_x, mt_y to recognize multi-touch gesture such as
>>>>>> zoom in, rotate ... but that is hacking way, perhaps there are some
>>>>>> synaptics developers already considered about multi-touch gesture
>>>>>> recognization requirement, it might be in TODO list.
>>>>>>
>>>>>> Please someone give me some advice, thanks a lot!
>>>>>>
>>>>>> Leslie Zhai
>>>>>> _______________________________________________
>>>>>> xorg-devel at lists.x.org: X.Org development
>>>>>> Archives: http://lists.x.org/archives/xorg-devel
>>>>>> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>>>>>>



More information about the xorg-devel mailing list