Re: [PATCH] hid-magicmouse: Correct parsing of large X and Y motions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 5 Jul 2010, Chase Douglas wrote:

> On Mon, 2010-07-05 at 10:50 -0400, Michael Poole wrote:
> > The X and Y values have two more significant bits in the same byte
> > that contains click status.  Include these in the reported value.
> > Thanks to Iain Hibbert of NetBSD for pointing this out.
> > 
> > Signed-off-by: Michael Poole <mdpoole@xxxxxxxxxxx>
> > ---
> >  drivers/hid/hid-magicmouse.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> > index 0b89c1c..7cdda23 100644
> > --- a/drivers/hid/hid-magicmouse.c
> > +++ b/drivers/hid/hid-magicmouse.c
> > @@ -267,8 +267,8 @@ static int magicmouse_raw_event(struct hid_device *hdev,
> >  		 * to have the current touch information before
> >  		 * generating a click event.
> >  		 */
> > -		x = (signed char)data[1];
> > -		y = (signed char)data[2];
> > +		x = (int)(((data[3] & 0x0c) << 28) | (data[1] << 22)) >> 22;
> > +		y = (int)(((data[3] & 0x30) << 26) | (data[2] << 22)) >> 22;
> >  		clicks = data[3];
> >  		break;
> >  	case 0x20: /* Theoretically battery status (0-100), but I have
> 
> Looks right to me.
> 
> Acked-by: Chase Douglas <chase.douglas@xxxxxxxxxxxxx>

Thanks. Applied to magicmouse branch now.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux