Re: [PATCH v3 1/2] Input: goodix - Add support for more then one touch-key

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

 



Hi Dmitry,

On Mon, Mar 16, 2020 at 10:53:03AM +0300, Dmitry Mastykin wrote:
> +static void goodix_ts_report_key(struct goodix_ts_data *ts, u8 *data)
> +{
> +	int touch_num;
> +	u8 key_value;
> +	int i;
> +
> +	if (data[0] & GOODIX_HAVE_KEY) {
> +		touch_num = data[0] & 0x0f;
> +		key_value = data[1 + ts->contact_size * touch_num];
> +		for (i = 0; i < GOODIX_MAX_KEYS; ++i)
> +			if (key_value & (1 << i))
> +				input_report_key(ts->input_dev, ts->keymap[i], 1);
> +	} else
> +		for (i = 0; i < GOODIX_MAX_KEYS; ++i)
> +			input_report_key(ts->input_dev, ts->keymap[i], 0);

Should this be written as:

	if (data[0] & GOODIX_HAVE_KEY) {
		touch_num = data[0] & 0x0f;
		key_value = data[1 + ts->contact_size * touch_num];
	} else {
		/* Release all keys */
		key_value = 0;
	}

	for (i = 0; i < GOODIX_MAX_KEYS; i++)
		input_report_key(ts->input_dev, ts->keymap[i],
				 key_value & BIT(i);

or the device may send incremental updates to the keys pressed without
resending currently pressed keys (sounds unlikely)?

Thanks.

-- 
Dmitry



[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