Re: [PATCH v3] input: add driver for pixcir i2c touchscreens

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

 



On Sat, Jul 09, 2011 at 01:12:10PM -0700, Dmitry Torokhov wrote:
> On Tue, Jul 05, 2011 at 09:30:20PM +0200, Henrik Rydberg wrote:
> > 
> > If the above function handles zero fingers as well, the MT finger
> > count comes out wrong in that case.
> > 
> 
> Hmm, indeed. How about the patch below instead?

Looks good, thanks.

    Acked-by: Henrik Rydberg <rydberg@xxxxxxxxxxx>

> +static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
> +{
> +	struct pixcir_i2c_ts_data *tsdata = data;
> +	u8 rdbuf[10], wrbuf[1] = { 0 };
> +	u8 touch, old_touch;
> +	int ret;
> +
> +	ret = i2c_master_send(tsdata->client, wrbuf, sizeof(wrbuf));
> +	if (ret != sizeof(wrbuf)) {
> +		dev_err(&tsdata->client->dev,
> +			"%s: i2c_master_send failed(), ret=%d\n",
> +			__func__, ret);
> +		return;
> +	}
> +
> +	ret = i2c_master_recv(tsdata->client, rdbuf, sizeof(rdbuf));
> +	if (ret != sizeof(rdbuf)) {
> +		dev_err(&tsdata->client->dev,
> +			"%s: i2c_master_recv failed(), ret=%d\n",
> +			__func__, ret);
> +		return;
> +	}
> +
> +	touch = rdbuf[0];
> +	old_touch = rdbuf[1];
> +	if (touch) {
> +		u16 posx1 = (rdbuf[3] << 8) | rdbuf[2];
> +		u16 posy1 = (rdbuf[5] << 8) | rdbuf[4];
> +		u16 posx2 = (rdbuf[7] << 8) | rdbuf[6];
> +		u16 posy2 = (rdbuf[9] << 8) | rdbuf[8];
> +
> +		input_report_key(tsdata->input, BTN_TOUCH, 1);
> +		input_report_abs(tsdata->input, ABS_X, posx1);
> +		input_report_abs(tsdata->input, ABS_Y, posy1);
> +
> +		input_report_abs(tsdata->input, ABS_MT_POSITION_X, posx1);
> +		input_report_abs(tsdata->input, ABS_MT_POSITION_Y, posy1);
> +		input_mt_sync(tsdata->input);
> +
> +		if (touch == 2) {
> +			input_report_abs(tsdata->input,
> +					 ABS_MT_POSITION_X, posx2);
> +			input_report_abs(tsdata->input,
> +					 ABS_MT_POSITION_Y, posy2);
> +			input_mt_sync(tsdata->input);
> +		}
> +	} else {
> +		input_report_key(tsdata->input, BTN_TOUCH, 0);
> +		if (old_touch)
> +			input_mt_sync(tsdata->input);
> +	}
> +
> +	input_sync(tsdata->input);
> +}

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