linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Henrik Rydberg" <rydberg@euromail.se>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: jcbian <jcbian@pixcir.com.cn>,
	linux-input@vger.kernel.org, dqmeng <dqmeng@pixcir.com.cn>,
	zlchen <zlchen@pixcir.com.cn>
Subject: Re: [PATCH v3] input: add driver for pixcir i2c touchscreens
Date: Tue, 5 Jul 2011 21:30:20 +0200	[thread overview]
Message-ID: <20110705193020.GB29549@polaris.bitmath.org> (raw)
In-Reply-To: <20110704165000.GD8144@core.coreip.homeip.net>

Hi Dmitry,

> +static void pixcir_ts_poscheck(struct pixcir_i2c_ts_data *data)
> +{
> +	struct pixcir_i2c_ts_data *tsdata = data;
> +
> +	u8 touching;
> +	u16 posx1, posy1, posx2, posy2;
> +	u8 rdbuf[10], wrbuf[1] = { 0 };
> +	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;
> +	}
> +
> +	touching = rdbuf[0];
> +	posx1 = (rdbuf[3] << 8) | rdbuf[2];
> +	posy1 = (rdbuf[5] << 8) | rdbuf[4];
> +	posx2 = (rdbuf[7] << 8) | rdbuf[6];
> +	posy2 = (rdbuf[9] << 8) | rdbuf[8];
> +
> +	input_report_key(tsdata->input, BTN_TOUCH, touching);
> +	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 (touching == 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);
> +	}
> +
> +	input_sync(tsdata->input);
> +}

If the above function handles zero fingers as well, the MT finger
count comes out wrong in that case.

Cheers,
Henrik

  reply	other threads:[~2011-07-05 19:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24  3:25 [PATCH v3] input: add driver for pixcir i2c touchscreens jcbian
2011-07-04 16:50 ` Dmitry Torokhov
2011-07-05 19:30   ` Henrik Rydberg [this message]
2011-07-09 20:12     ` Dmitry Torokhov
2011-07-23 18:18       ` Henrik Rydberg
2011-07-14  2:21     ` jcbian
2011-07-23 18:24       ` Henrik Rydberg
2011-07-04 20:49 ` Henrik Rydberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110705193020.GB29549@polaris.bitmath.org \
    --to=rydberg@euromail.se \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dqmeng@pixcir.com.cn \
    --cc=jcbian@pixcir.com.cn \
    --cc=linux-input@vger.kernel.org \
    --cc=zlchen@pixcir.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).