lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 13 Oct 2010 13:35:08 -0400
From:	Chase Douglas <chase.douglas@...onical.com>
To:	Henrik Rydberg <rydberg@...omail.se>
Cc:	Jiri Kosina <jkosina@...e.cz>,
	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	Philipp Merkel <mail@...lmerk.de>,
	Stephane Chatty <chatty@...c.fr>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] hid: egalax: Convert to MT slots

On Wed, 2010-10-13 at 15:58 +0200, Henrik Rydberg wrote:
> The joojoo reports touches sequentially, one per report, which
> confuses the current driver. Convert to the MT slots protocol and use
> the stored slot information to emulate pointer movement in a stable
> manner.
> 
> Tested-by: Philipp Merkel <mail@...lmerk.de>
> Signed-off-by: Henrik Rydberg <rydberg@...omail.se>

[...]

> @@ -122,64 +133,61 @@ static int egalax_input_mapped(struct hid_device *hdev, struct hid_input *hi,
>  	return -1;
>  }
>  
> +static void emulate_pointer(struct egalax_data *td, struct input_dev *input)
> +{
> +	struct egalax_contact *s = &td->single;
> +	struct egalax_contact *best = 0;
> +	int dbest, i;
> +
> +	for (i = 0; i < MAX_SLOTS; i++) {
> +		struct egalax_contact *f = &td->contact[i];
> +		if (f->touch) {
> +			int d = abs(f->x - s->x) + abs(f->y - s->y);
> +			if (!best || d < dbest) {
> +				best = f;
> +				dbest = d;
> +			}

Wouldn't it be better to do a real distance comparison:

int d = (f->x - s->x) * (f->x - s->x) + (f->y - s->y) * (f->y - s->y)

That should be the square of the actual distance between two contacts.

The rest looks ok to me.

-- Chase

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ