lkml.org 
[lkml]   [2012]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/3] hid-multitouch: add support for trackpads
On Fri, Jan 20, 2012 at 05:09:48PM +0100, Henrik Rydberg wrote:
> Hi Benjamin,
>
> > @@ -389,9 +404,19 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
> > td->last_field_index = field->index;
> > return -1;
> > }
> > + case HID_DG_TOUCH:
> > + /* Legacy devices use TIPSWITCH and not TOUCH.
> > + * Let's just ignore this field. */
> > + return -1;
> > /* let hid-input decide for the others */
> > return 0;
> >
> > + case HID_UP_BUTTON:
> > + code = ((usage->hid - 1) & HID_USAGE) + BTN_MOUSE;
>
> Why '+' here instead of '|' is beyond me...

Because it is an offset for the range. The fact that it is on power 2
boundary and we can use "|" is purely coincidential here.

Maybe we should even write it as:

code = BTN_MOUSE + ((usage->hid - 1) & HID_USAGE);

Thanks,
Dmitry

--
Dmitry


\
 
 \ /
  Last update: 2012-01-20 17:51    [W:0.075 / U:3.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site