Re: [PATCH v3 4/4] input: alps: Fix trackstick detection

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

 



On Friday 14 November 2014 12:22:33 Pali Rohár wrote:
> On Sunday 09 November 2014 12:30:03 Pali Rohár wrote:
> > 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.
> 
> Dmitry: PING
> Also see my comment for PATCH v3 3/4.

Dmitry, finally I split this big patch into more smaller and 
tried to fix what you did not like. I sent new series of patches, 
so drop this one 4/4.

-- 
Pali Rohár
pali.rohar@xxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.


[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