Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 298459 - sys-auth/thinkfinger: xf86-input-evdev-2.3.1 requires devices to send EVSYN events
Summary: sys-auth/thinkfinger: xf86-input-evdev-2.3.1 requires devices to send EVSYN e...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Víctor Enríquez
URL: https://bugs.freedesktop.org/show_bug...
Whiteboard:
Keywords: EBUILD
Depends on:
Blocks:
 
Reported: 2009-12-26 18:06 UTC by mephinet
Modified: 2010-04-11 15:32 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
lshal output (lshal.out,973 bytes, text/plain)
2009-12-27 12:56 UTC, mephinet
Details
patch that sends sync event (0.3-send-sync-event.patch,1.01 KB, patch)
2009-12-27 17:57 UTC, mephinet
Details | Diff
ebuild that applies the patch (thinkfinger-0.3-r2.ebuild,2.11 KB, text/plain)
2009-12-27 17:57 UTC, mephinet
Details
file found on my system in addition to thinkfinger (60-thinkfinger.rules,599 bytes, text/plain)
2010-03-23 18:05 UTC, Michael Weber (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mephinet 2009-12-26 18:06:46 UTC
sys-auth/thinkfinger providers a PAM module to allow authentication to the system using a UPEK/SGS Thomson Microelectronics fingerprint reader, as featured e.g. on Thinkpad notebooks.

With the upgrade to x11-drivers/xf86-input-evdev-2.3.1, this authentication stops to work as expected: swiping the finger over the sensor does not perform a login any more. However, pressing Enter on an external USB keyboard after the swipe results in a successful login.

Same behaviour can be observed with the (currently masked) x11-drivers/xf86-input-evdev-2.3.2.
Downgrading to x11-drivers/xf86-input-evdev-2.5.2 fixes the issue.

The fingerprint reader as such works fine, as can be verified with the tf-tool, which is also part of sys-auth/thinkfinger.
Comment 1 mephinet 2009-12-26 18:10:19 UTC
A bug with identical symptoms has been reported over a year ago for ubuntu:
<https://bugs.launchpad.net/ubuntu/+source/thinkfinger/+bug/256429>
Comment 2 mephinet 2009-12-26 18:31:29 UTC
Only reproducible in the X server context. On the system console, swiping works as expected.
Comment 3 mephinet 2009-12-26 18:54:02 UTC
Using the evbug kernel module, the difference between 2.2.5 (good) and 2.3.1 (bad) becomes visible:

Whereas 2.2.5 sends 3 events:
Event. Dev: input11, Type: 1, Code: 28, Value: 1
Event. Dev: input11, Type: 1, Code: 28, Value: 0
Event. Dev: input11, Type: 0, Code: 0, Value: 1

2.3.1 sends only two:
Event. Dev: input12, Type: 1, Code: 28, Value: 1
Event. Dev: input12, Type: 1, Code: 28, Value: 0

and the missing 3rd event is only sent after pressing enter:
Event. Dev: input7, Type: 4, Code: 4, Value: 458792
Event. Dev: input7, Type: 1, Code: 28, Value: 1
Event. Dev: input7, Type: 0, Code: 0, Value: 0
Event. Dev: input12, Type: 0, Code: 0, Value: 1
Comment 4 mephinet 2009-12-26 19:26:12 UTC
AFAIK, the ubuntu bug is resolved by adding a bogus second key to the uinput "keyboard", so that it is no longer handled as a button by hal. This bugfix is performed by the 0.3-carriagereturn.patch of sys-auth/thinkfinger-0.3-r1, which I am using - so it does not fix the issue for me.

Another tip there is to add a bogus "kbd" section to the xorg.conf and add it to the serverlayout. This does not change the situation for me, either.
Comment 5 mephinet 2009-12-26 21:32:56 UTC
link to upstream bug report added
Comment 6 Rémi Cardona gentoo-dev 2009-12-27 11:33:03 UTC
Looks like HAL is also involved in this...

I'm not sure x11 has anything to do here.

Thanks
Comment 7 mephinet 2009-12-27 12:56:32 UTC
Created attachment 214291 [details]
lshal output

wrt hal: the output of lshal is identical for both the good version 2.2.5 and the bad version 2.3.1 of x11-drivers/xf86-input-evdev.
Comment 8 mephinet 2009-12-27 15:48:59 UTC
I bisected my way through xf86-input-evdev version 2.2.5 to 2.3.1 and found this commit to be the first bad one:

commit 1f641d75edba7394201c1c53938215bae696791b
Author: Oliver McFadden <oliver.mcfadden@nokia.com>
Date:   Thu Jul 23 13:19:49 2009 +0300

    evdev: Only send the events at synchronization time.
    
    Instead of just posting the button/key press/release events to the
    server as soon as they arrive, add them to an internal queue and post
    them once we receive an EV_SYN synchronization event.
    
    The motion events are always sent first, followed by the queued events.
    There will be one motion event and possibly many queued button/key
    events posted every EV_SYN event.
    
    Note that the size of the event queue (EVDEV_MAXQUEUE) is arbitrary and
    you may change it. If we receive more events than the queue can handle,
    those events are dropped and a warning message printed.
    
    Tested on my Lenovo T400 using evdev for all input devices; keyboard,
    touchpad, and trackpoint.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Comment 9 Jon Oberheide 2009-12-27 17:02:18 UTC
Based on the commit message, I would try sending a EV_SYN after the EV_KEY events in uinput_cr() in pam_thinkfinger-uinput.c.

Something like:

    struct input_event ev = {
        .type = EV_SYN,
        .code = SYN_REPORT,
        .time = {0, }.
        .value = 0
    };
    ev_size = sizeof(ev);
    write (*fd, &ev, ev_size);

I don't have the hardware to test though.  I'd still recommend the "bogus second key" patch in addition though since I don't think that has been upstreamed to hal yet.  I don't think you'd see any difference in lshal since the virtual uinput keyboard is created/destroyed on the fly.

Regards,
Jon Oberheide
Comment 10 mephinet 2009-12-27 17:06:20 UTC
(In reply to comment #9)
> Based on the commit message, I would try sending a EV_SYN after the EV_KEY
> events in uinput_cr() in pam_thinkfinger-uinput.c.

I'll give it a try!

> I don't have the hardware to test though.  I'd still recommend the "bogus
> second key" patch in addition though since I don't think that has been
> upstreamed to hal yet.  I don't think you'd see any difference in lshal since
> the virtual uinput keyboard is created/destroyed on the fly.

I ran lshal while the fingerprint reader was "running", e.g. between the PAM authentication request and swiping my finger. During that period of time, a "Virtual ThinkFinger Keyboard" shows up in the lshal output.
Comment 11 mephinet 2009-12-27 17:45:52 UTC
(In reply to comment #9)
> Based on the commit message, I would try sending a EV_SYN after the EV_KEY
> events in uinput_cr() in pam_thinkfinger-uinput.c.

Dear Jon,

thanks for your input - sending a sync event after the key event fixes the issue - without having adverse effects on pam_thinkfinger on the commandline. Tested with x11-drivers/xf86-input-evdev-2.3.1.
Comment 12 mephinet 2009-12-27 17:57:05 UTC
Created attachment 214331 [details, diff]
patch that sends sync event

patch applied that sends sync event after keys.
Comment 13 mephinet 2009-12-27 17:57:33 UTC
Created attachment 214334 [details]
ebuild that applies the patch
Comment 14 Jon Oberheide 2009-12-27 18:00:55 UTC
Awesome! Glad you got it working!

Regards,
Jon Oberheide
Comment 15 mephinet 2009-12-27 18:06:39 UTC
Thanks Jon!

Patch submitted upstream:
https://sourceforge.net/tracker/?func=detail&atid=889697&aid=2921928&group_id=179573
Comment 16 Rémi Cardona gentoo-dev 2009-12-27 23:20:21 UTC
Ok then nothing for X11 or HAL teams, reassigning.

Thanks for finding the cause of this, very interesting read :)

Thanks
Comment 17 jcat 2010-01-08 00:27:51 UTC
Thanks a lot, this patches fixes my issue too :)


Cheers,
jcat
Comment 18 Henning Schild 2010-01-11 13:31:31 UTC
Thank you. I first found your patch upstream and wrote my own -r2. When I wanted to file the report I found this one.
The -r2 ebuild should make its way into the tree!
Comment 19 Karl Hakimian 2010-01-15 15:53:11 UTC
The supplied patch and ebuild solves this for me as well. Thanks. This was driving me crazy.
Comment 20 Bailey Kong 2010-01-18 17:11:11 UTC
Confirmation that it works for me here as well.
Comment 21 Riccardo Brasca 2010-02-07 22:09:59 UTC
Works for me on amd64. When will this be in the tree?
Comment 22 Jan Krieg 2010-02-19 15:05:48 UTC
ACK, the -r2 ebuild show go into the tree. Works well for x86 here.
Comment 23 Víctor Enríquez 2010-02-20 16:22:05 UTC
Sorry, I don't have much time now, but I will try to put this on portage ASAP. Thanks for the patch :). 
Comment 24 Michael Weber (RETIRED) gentoo-dev 2010-03-23 18:05:53 UTC
Created attachment 224929 [details]
file found on my system in addition to thinkfinger

this -r2 ebuild works fine on mu amd64 with x11-drivers/xf86-input-evdev-2.3.2
Comment 25 Tony Vroon gentoo-dev 2010-04-11 15:32:11 UTC
+*thinkfinger-0.3-r2 (11 Apr 2010)
+
+  11 Apr 2010; <chainsaw@gentoo.org> +files/0.3-send-sync-event.patch,
+  -thinkfinger-0.2.2-r1.ebuild, -thinkfinger-0.3.ebuild,
+  files/60-thinkfinger.rules, -thinkfinger-0.3-r1.ebuild,
+  +thinkfinger-0.3-r2.ebuild:
+  Revision bump by Víctor Enríquez Miguel. Patches from mephinet & Michael
+  Weber close bug #298459. Patch from Michael Weber closes bug #309751.