[PATCH libevdev 3/3] tools: complain about devices that aren't touchpads in the edge detector

Benjamin Tissoires benjamin.tissoires at gmail.com
Tue Jan 20 09:14:47 PST 2015


On Mon, Jan 12, 2015 at 7:57 PM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  tools/touchpad-edge-detector.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/tools/touchpad-edge-detector.c b/tools/touchpad-edge-detector.c
> index df0f032..94cd71a 100644
> --- a/tools/touchpad-edge-detector.c
> +++ b/tools/touchpad-edge-detector.c
> @@ -140,6 +140,13 @@ touchpad_edge_detector (int argc, char **argv) {
>         if (!dev)
>                 return EXIT_FAILURE;
>
> +       if (!libevdev_has_event_code(dev, EV_ABS, ABS_X) ||
> +           !libevdev_has_event_code(dev, EV_ABS, ABS_Y)) {
> +               fprintf(stderr, "Error: this device does not have abs axes\n");
> +               rc = EXIT_FAILURE;
> +               goto out;
> +       }
> +

Hmm... yes, but how about 3 axis accelerometers? :-) just kidding...
I believe the commit message should not mention "touchpads" but "non
compatible devices".
We can run the tool on a touchscreen or a tablet with a pen and get
interesting values out of it.

So basically, here you are preventing a misuse of the tool, which is
fine and should be, but the justification is wrong IMO.

Anyway this one is rev-by me.
The 2 others, I'd like to have at least a "I will come with a v2" or
"go to hell" before giving a rev-by :)

Cheers,
Benjamin

>         dim.left = INT_MAX;
>         dim.right = INT_MIN;
>         dim.top = INT_MAX;
> @@ -159,6 +166,7 @@ touchpad_edge_detector (int argc, char **argv) {
>
>         printf("\n");
>
> +out:
>         close_device(dev);
>
>         return rc;
> --
> 2.1.0
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list