Bug 68415 - touchscreen wheelEmulation , any touches makes scroll to the bottom
Summary: touchscreen wheelEmulation , any touches makes scroll to the bottom
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/evdev (show other bugs)
Version: unspecified
Hardware: Other Linux (All)
: medium normal
Assignee: Peter Hutterer
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-22 08:38 UTC by laurent
Modified: 2013-10-22 03:59 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
0001-Fix-wheel-emulation-for-absolute-device-68415.patch (4.88 KB, patch)
2013-08-28 04:52 UTC, Peter Hutterer
no flags Details | Splinter Review

Description laurent 2013-08-22 08:38:19 UTC
I would like to use the wheelEmulation for a touchscreen.
I have setup all the options:

Evdev Wheel Emulation (287):	1
	Evdev Wheel Emulation Axes (288):	0, 0, 4, 5
	Evdev Wheel Emulation Inertia (289):	10
	Evdev Wheel Emulation Timeout (290):	200
	Evdev Wheel Emulation Button (291):	1     // single touch touchscreen

Once activated, whenever I touched the screen even without moving I had the scroll to bottom. So I went to the code of driver : xf86-input-evdev-2.8.0

Here is what I pointed out :
/* We don't want to intercept real mouse wheel events */
         if(pEv->type == EV_ABS) {

             int axis = pEvdev->abs_axis_map[pEv->code];
             oldValue = valuator_mask_get(pEvdev->vals, axis);
                 xf86IDrvMsg(pInfo, X_WARNING, "oldValue : %d\n",oldValue);
             valuator_mask_set(pEvdev->vals, axis, value);
             value -= oldValue; /* make value into a differential
 measurement */
         }

 the oldValue is in my case always equals to zero, which make then the
 driver not working properly.

the pEvdev vals is reset here evdev.c line 1037:
   if (pEvdev->vals)
        valuator_mask_zero(pEvdev->vals);

so I commented theses lines. But then I get funny movements.
so I put the lines here emuWheels.c line 80
else {
            ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
            if (ms > 0 || wheelDone == 0) {
                /*
                 * If the button is released early enough emit the button
                 * press/release events
                 */
                if (pEvdev->vals)
                        valuator_mask_zero(pEvdev->vals);

                EvdevQueueButtonClicks(pInfo, button, 1);
            }
        }
the funny movements were off. So far so good. But now in some cases, when I first touch the touchscreen I get some scroll down movements. 
So I did modify this (emuWheel.c):
        if(pEv->type == EV_ABS) {

            int axis = pEvdev->abs_axis_map[pEv->code];
            oldValue = valuator_mask_get(pEvdev->vals, axis);
                valuator_mask_set(pEvdev->vals, axis, value);
                if(oldValue==0 || (abs(oldValue-value))>200)
                {
                       
                        return TRUE;
                }
value -= oldValue; /* make value into a differential measurement */


and this (emuWheel.c):

    /* if this axis has not been configured, just eat the motion */
    if (!axis->up_button)
        return rc;
        xf86IDrvMsg(pInfo, X_WARNING, "axis->traveled_distance %d\n",axis->traveled_distance);
        if (axis->traveled_distance == 0 || (abs(value) < 10) )
        {
                axis->traveled_distance += value;
                return rc;
        }

    axis->traveled_distance += value;


then it seems to be ok for me. Except for slow movements that do not make scroll. and that the scroll is not smooth.

I did also something else, I wanted to have click on release even after the timeout of enable wheelEmulation. So even if the timeout is there , if there were no scroll activated then the button is clicked.  I added a global variable set when there is a scroll, and reset when button is pressed.


Kind regards,
Laurent.
Comment 1 Peter Hutterer 2013-08-28 04:52:55 UTC
Created attachment 84762 [details] [review]
0001-Fix-wheel-emulation-for-absolute-device-68415.patch
Comment 2 laurent 2013-09-16 09:48:23 UTC
which info ?
Comment 3 Peter Hutterer 2013-09-16 20:55:55 UTC
if you can, please test the patch from comment #1
Comment 4 laurent 2013-10-02 07:22:47 UTC
hello,  do I  have to do the change in my own file, or do you have "ready" file that I can use ?
Comment 5 laurent 2013-10-02 08:55:25 UTC
So I did modified the emuWheels and evdev files.
I can only scroll in one direction, to the top.
Comment 6 Peter Hutterer 2013-10-02 10:07:45 UTC
(In reply to comment #4)
> hello,  do I  have to do the change in my own file, or do you have "ready"
> file that I can use ?

please apply it to your git tree. judging by Comment #0 I guess you already have one.



(In reply to comment #5)
> So I did modified the emuWheels and evdev files.
> I can only scroll in one direction, to the top.

this was on a vanilla checkout? did you revert your previous patches?
Comment 7 laurent 2013-10-02 12:10:16 UTC
(In reply to comment #6)
> (In reply to comment #4)
> > hello,  do I  have to do the change in my own file, or do you have "ready"
> > file that I can use ?
> 
> please apply it to your git tree. judging by Comment #0 I guess you already
> have one.
> 
no, and I must that I have lear something :-)
> 
> 
> (In reply to comment #5)
> > So I did modified the emuWheels and evdev files.
> > I can only scroll in one direction, to the top.
> 
> this was on a vanilla checkout? did you revert your previous patches?
I did take a clean version of xf86-input-evdev-2.8.1, apply your patches and recompile it.
Comment 8 laurent 2013-10-02 12:35:40 UTC
ok I installed the git tree, trying to checkout the vanilla branches but no help.

I took git tree from here :
http://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdev.git
Comment 9 laurent 2013-10-02 13:24:01 UTC
from the new source , now I have a more or less correct behaviour. 
still something annoying. When I press the screen and don't move, is interpreted as wheel movement.
Comment 10 Peter Hutterer 2013-10-22 03:59:20 UTC
chances are high that when you don't move, there is still some amount of movement happening. Check with evemu-record and have a look at the event data.

That's a separate issue we need to address one day, but not directly part of this bug.


Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Aug 26 14:56:07 2013 +1000

    Fix wheel emulation for absolute device (#68415)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.