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  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:	Sun, 9 Nov 2014 12:30:03 +0100
From:	Pali Rohár <pali.rohar@...il.com>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	Hans de Goede <hdegoede@...hat.com>,
	Yunkang Tang <yunkang.tang@...alps.com>,
	Tommy Will <tommywill2011@...il.com>,
	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 4/4] input: alps: Fix trackstick detection

On Sunday 09 November 2014 09:05:04 Dmitry Torokhov wrote:
> Hi Pali,
> 
> On Sun, Nov 02, 2014 at 12:25:10AM +0100, Pali Rohár wrote:
> >  int alps_detect(struct psmouse *psmouse, bool
> >  set_properties) {
> > 
> > -	struct alps_data dummy;
> > +	unsigned char e6[4];
> > 
> > -	if (alps_identify(psmouse, &dummy) < 0)
> > -		return -1;
> > +	/*
> > +	 * Try "E6 report".
> > +	 * ALPS should return 0,0,10 or 0,0,100 if no buttons are
> > pressed. +	 * The bits 0-2 of the first byte will be 1s if
> > some buttons are +	 * pressed.
> > +	 */
> > +	if (alps_rpt_cmd(psmouse, PSMOUSE_CMD_SETRES,
> > +			 PSMOUSE_CMD_SETSCALE11, e6))
> > +		return -EIO;
> > +
> > +	if ((e6[0] & 0xf8) != 0 || e6[1] != 0 || (e6[2] != 10 &&
> > e6[2] != 100)) +		return -EINVAL;
> > 
> >  	if (set_properties) {
> > 
> > +		/*
> > +		 * NOTE: To detect model and trackstick presence we 
need
> > to do +		 *       full device reset. To speed up 
detection
> > and prevent +		 *       calling duplicate initialization
> > sequence (both in +		 *       alps_detect() and
> > alps_init()) we set model/protocol +		 *       version and
> > correct name in alps_init() (which will +		 *       do 
full
> > device reset). For now set name to DualPoint. +		 */
> > 
> >  		psmouse->vendor = "ALPS";
> > 
> > -		psmouse->name = dummy.flags & ALPS_DUALPOINT ?
> > -				"DualPoint TouchPad" : "GlidePoint";
> > -		psmouse->model = dummy.proto_version << 8;
> > +		psmouse->name = "DualPoint TouchPad";
> > 
> >  	}
> > 
> > +
> > 
> >  	return 0;
> 
> We can't do this; going by e6 only will give us false
> positives and alps_detect is supposed to be authoritative.
> 
> Thanks.

psmouse-base.c is calling alps_detect() and alps_init() 
consecutively so it does not matter if code is in _detect or 
_init function. Just need to make sure that correct order will be 
used. So this patch could not bring any problems.

If psmouse-base.c detect device false-positive as ALPS (with 
alps_detect()) then it immediately calls alps_init() which fails 
and psmouse-base.c will try to use another protocol.

-- 
Pali Rohár
pali.rohar@...il.com

Download attachment "signature.asc " of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists