Re: [PATCH] Improve Alps HID Touchpad code

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

 



On Wed, Jun 22, 2016 at 01:11:08PM +0900, Masaki Ota wrote:
>  
> -		input_event(hdata->input, EV_KEY, BTN_LEFT, left);
> -		input_event(hdata->input, EV_KEY, BTN_RIGHT, right);
> -		input_event(hdata->input, EV_KEY, BTN_MIDDLE, middle);
> +		input_report_key(hdata->input, BTN_LEFT,
> +			data[1] & 0x1);
> +		input_report_key(hdata->input, BTN_RIGHT,
> +			(data[1] & 0x2) >> 1);
> +		input_report_key(hdata->input, BTN_MIDDLE,
> +			(data[1] & 0x4) >> 2);

There is no really need to do shifts as input_report_key() converts
value to 0/1 for you.

> +
> +		input_sync(hdata->input);
>  
>  		return 1;
>  
>  	case U1_SP_ABSOLUTE_REPORT_ID:
> -		sp_x = (data[2] | (data[3] << 8));
> -		sp_y = (data[4] | (data[5] << 8));
> -		sp_z = (data[6] | data[7]) & 0x7FFF;
> -		left = data[1] & 0x1;
> -		right = (data[1] & 0x2) >> 1;
> -		middle = (data[1] & 0x4) >> 2;
> +		sp_x = get_unaligned_le16(data+2);
> +		sp_y = get_unaligned_le16(data+4);
>  
>  		sp_x = sp_x / 8;
>  		sp_y = sp_y / 8;
>  
> -		input_event(priv->input2, EV_REL, REL_X, sp_x);
> -		input_event(priv->input2, EV_REL, REL_Y, sp_y);
> +		input_report_rel(hdata->input2, REL_X, sp_x);
> +		input_report_rel(hdata->input2, REL_Y, sp_y);
>  
> -		input_event(priv->input2, EV_KEY, BTN_LEFT, left);
> -		input_event(priv->input2, EV_KEY, BTN_RIGHT, right);
> -		input_event(priv->input2, EV_KEY, BTN_MIDDLE, middle);
> +		input_report_key(hdata->input2, BTN_LEFT,
> +			data[1] & 0x1);
> +		input_report_key(hdata->input2, BTN_RIGHT,
> +			(data[1] & 0x2) >> 1);
> +		input_report_key(hdata->input2, BTN_MIDDLE,
> +			(data[1] & 0x4) >> 2);

Same here. Maybe Jiri will fix it up by hand while appplying?

Otherwise:

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>

-- 
Dmitry
--
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