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

From
Henrik Rydberg <hidden>
Date
2011-07-05 19:28:27
Reply to
Dmitry Torokhov, 2011-07-05
Hi Dmitry,
quoted hunk ↗ jump to hunk
+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
Thread (8 messages) 8 messages, 3 authors, last reply 2011-07-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help