linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Peter Wu <peter@lekensteyn.nl>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andrew de los Reyes <adlr@chromium.org>,
	Jiri Kosina <jkosina@suse.cz>
Subject: Re: About "HID: logitech-hidpp: add support of the first Logitech Wireless Touchpad"
Date: Thu, 11 Dec 2014 10:19:33 -0500	[thread overview]
Message-ID: <20141211151933.GB29747@mail.corp.redhat.com> (raw)
In-Reply-To: <1659058.m7A8Z3l7lH@al>

Hi Peter,

On Dec 11 2014 or thereabouts, Peter Wu wrote:
> Hi Benjamin,
> 
> In commit 57ac86cf52e903d9e3e0f12b34c814cce6b65550 ("HID:
> logitech-hidpp: add support of the first Logitech Wireless Touchpad")
> which is in jikos/hid, you made this change to wtp_raw_event:
> 
>         switch (data[0]) {
>         case 0x02:
> -               if (size < 21)
> -                       return 1;
> -               return wtp_mouse_raw_xy_event(hidpp, &data[7]);
> +               if (hidpp->quirks & HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS) {
> +                       input_event(wd->input, EV_KEY, BTN_LEFT,
> +                                       !!(data[1] & 0x01));
> +                       input_event(wd->input, EV_KEY, BTN_RIGHT,
> +                                       !!(data[1] & 0x02));
> +                       input_sync(wd->input);
> +               } else {
> +                       if (size < 21)
> +                               return 1;
> +                       return wtp_mouse_raw_xy_event(hidpp, &data[7]);
> +               }
>         case REPORT_ID_HIDPP_LONG:
>                 if ((report->fap.feature_index != wd->mt_feature_index) ||
>                     (report->fap.funcindex_clientid != EVENT_TOUCHPAD_RAW_XY))
>                         return 1;
>                 hidpp_touchpad_raw_xy_event(hidpp, data + 4, &raw);
>  
>                 wtp_send_raw_xy_event(hidpp, &raw);
>                 return 0;
>         }
> 
> Report ID 2 is the mouse descriptor, so it seems correct in that it
> falls-through to the next case, but I wanted to check with you that this
> is indeed your intention. If so, could you explicitly mark it with a
> comment, /* fallthrough */ ?

Yep, it is indeed a bug. I see what happened:
The old code contained a return at the end of the case, and I completely
forget to prevent the fall through with a break. Gosh, I should have
been more careful. Thanks for spotting that!

Cheers,
Benjamin

> -- 
> Kind regards,
> Peter
> https://lekensteyn.nl
> 

      reply	other threads:[~2014-12-11 15:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11 10:02 About "HID: logitech-hidpp: add support of the first Logitech Wireless Touchpad" Peter Wu
2014-12-11 15:19 ` Benjamin Tissoires [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141211151933.GB29747@mail.corp.redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=adlr@chromium.org \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@lekensteyn.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).