linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-kernel@vger.kernel.org,
	Henrik Rydberg <rydberg@bitmath.org>,
	James Chen <james.chen@emc.com.tw>,
	Johnny Chuang <johnny.chuang@emc.com.tw>,
	Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh-dt@kernel.org>,
	Scott Liu <scott.liu@emc.com.tw>
Subject: Re: [PATCH v2 2/9] input: elants: support old touch report format
Date: Fri, 13 Dec 2019 03:06:09 +0300	[thread overview]
Message-ID: <d30d60e6-f9cc-d92e-f875-3d862c8e8c44@gmail.com> (raw)
In-Reply-To: <20191212194552.GA22553@qmqm.qmqm.pl>

12.12.2019 22:45, Michał Mirosław пишет:
> On Thu, Dec 12, 2019 at 03:54:13AM +0300, Dmitry Osipenko wrote:
>> 11.12.2019 19:03, Michał Mirosław пишет:
>>> Support ELAN touchpad sensor with older firmware as found on eg. Asus
>>> Transformer Pads.
> [...]
>>> @@ -814,8 +817,16 @@ static void elants_i2c_mt_event(struct elants_data *ts, u8 *buf)
>>>  			pos = &buf[FW_POS_XY + i * 3];
>>>  			x = (((u16)pos[0] & 0xf0) << 4) | pos[1];
>>>  			y = (((u16)pos[0] & 0x0f) << 8) | pos[2];
>>> -			p = buf[FW_POS_PRESSURE + i];
>>> -			w = buf[FW_POS_WIDTH + i];
>>> +			if (report_len == PACKET_SIZE_OLD) {
>>> +				w = buf[FW_POS_WIDTH + i / 2];
>>> +				w >>= 4 * (~i & 1);	// little-endian-nibbles
>>> +				w |= w << 4;
>>> +				w |= !w;
>>> +				p = w;
>>
>> Did you copy this from the downstream driver as-is? I'm looking at the
>> Nexus 7 driver and it does the following for older format:
>>
>> u8 size_idx[] = { 35, 35, 36, 36, 37, 37, 38, 38, 39, 39 };
>> unsigned int s;
>>
>> if (i & 1)
>> 	s = buf[size_idx[i]];
>> else
>> 	s = buf[size_idx[i]] / 16;
>>
>> w = s & 0xf;
>> p = s * 16;
> 
> This is the same thing modulo (w), which is scaled here to declared axis
> range (1-255 from 0-15, assuming 0 means "no touch" so it should not occur).
> 
> OTOH, I admit, that I don't have any software that can verify those
> settings. It might be that eg. one of MT_PRESSURE or MT_TOUCH_MAJOR axes
> should be dropped in this case, but with no docs I can't be sure what
> the reported values really are.
> 
> This is from the original (GPL) code dump labeled 'Asus 10_6_1_27_5':
> 
> |  touch_size = ((i & 0x01) ? buf[size_index[i]] : (buf[size_index[i]] >> 4)) & 0x0F;
> |  if(touch_size == 0) touch_size = 1;
> |  if (touch_size <= 7)
> |      touch_size = touch_size << 5;
> |  else
> |      touch_size = 255;
> |    
> |    input_report_abs(idev, ABS_MT_TOUCH_MAJOR, touch_size);
> |    input_report_abs(idev, ABS_MT_PRESSURE, touch_size);

Okay, I also don't know how to test it properly.

If anyone knows, please let us know :)



  reply	other threads:[~2019-12-13  0:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11 16:03 [PATCH v2 0/9] input: elants: Support Asus TF300T touchscreen Michał Mirosław
2019-12-11 16:03 ` [PATCH v2 2/9] input: elants: support old touch report format Michał Mirosław
2019-12-12  0:54   ` Dmitry Osipenko
2019-12-12 19:45     ` Michał Mirosław
2019-12-13  0:06       ` Dmitry Osipenko [this message]
2019-12-11 16:03 ` [PATCH v2 3/9] input: elants: remove unused axes Michał Mirosław
2019-12-12  0:34   ` Dmitry Osipenko
2019-12-11 16:03 ` [PATCH v2 1/9] input: elants: document some registers and values Michał Mirosław
2019-12-12  0:34   ` Dmitry Osipenko
2019-12-11 16:03 ` [PATCH v2 4/9] input: elants: override touchscreen info with DT properties Michał Mirosław
2019-12-11 16:03 ` [PATCH v2 5/9] input: elants: refactor elants_i2c_execute_command() Michał Mirosław
2019-12-12  0:30   ` Dmitry Osipenko
2019-12-11 16:03 ` [PATCH v2 6/9] input: elants: read touchscreen size for EKTF3624 Michał Mirosław
2019-12-12  0:39   ` Dmitry Osipenko
2019-12-11 16:03 ` [PATCH v2 7/9] input: elants: support 0x66 reply opcode for reporting touches Michał Mirosław
2019-12-11 16:03 ` [PATCH v2 8/9] dt-bindings: input: elants-i2c: Document common touchscreen properties Michał Mirosław
2019-12-12  0:58   ` Dmitry Osipenko
2019-12-12  1:00     ` Dmitry Osipenko
2019-12-19 21:39   ` Rob Herring
2019-12-11 16:03 ` [PATCH v2 9/9] dt-bindings: input: elants-i2c: Document eKTF3624 Michał Mirosław
2019-12-19 21:43   ` Rob Herring
2019-12-20  1:10     ` Dmitry Osipenko
2019-12-12  0:29 ` [PATCH v2 0/9] input: elants: Support Asus TF300T touchscreen Dmitry Osipenko
2019-12-12 19:24 ` Dmitry Torokhov
2020-01-07  5:33   ` Dmitry Osipenko
2020-01-08 15:00     ` Johnny.Chuang
2020-01-08 15:37       ` Dmitry Osipenko
2020-01-23 19:16         ` Dmitry Osipenko
2020-02-05 22:04           ` Dmitry Osipenko

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=d30d60e6-f9cc-d92e-f875-3d862c8e8c44@gmail.com \
    --to=digetx@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=james.chen@emc.com.tw \
    --cc=johnny.chuang@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=robh-dt@kernel.org \
    --cc=rydberg@bitmath.org \
    --cc=scott.liu@emc.com.tw \
    /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).