From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: linux-input@vger.kernel.org, Yunkang Tang <yunkang.tang@cn.alps.com>
Subject: Re: [PATCH v2] alps: Add support for v7 devices
Date: Sat, 26 Jul 2014 14:09:12 -0700 [thread overview]
Message-ID: <20140726210912.GA11800@core.coreip.homeip.net> (raw)
In-Reply-To: <1406376832-7135-1-git-send-email-hdegoede@redhat.com>
Hi Hans,
On Sat, Jul 26, 2014 at 02:13:52PM +0200, Hans de Goede wrote:
> From: Yunkang Tang <yunkang.tang@cn.alps.com>
>
> Such as found on the new Toshiba Portégé Z30-A and Z40-A.
>
> Signed-off-by: Yunkang Tang <yunkang.tang@cn.alps.com>
> [hdegoede@redhat.com: Remove softbutton handling, this is done in userspace]
> [hdegoede@redhat.com: Report INPUT_PROP_BUTTONPAD]
> [hdegoede@redhat.com: Do not report fake PRESSURE, reporting BTN_TOUCH is
> enough]
> [hdegoede@redhat.com: Various cleanups / refactoring]
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> --
> Changes in v2:
> -alps_is_valid_package_v7: switch to using a switch-case
> -alps_check_valid_firmware_id: fix to not always return true
Thank you for whipping the update so quickly.
> +
> +static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt,
> + unsigned char *pkt,
> + unsigned char pkt_id)
> +{
> + mt[0].x = ((pkt[2] & 0x80) << 4);
> + mt[0].x |= ((pkt[2] & 0x3F) << 5);
> + mt[0].x |= ((pkt[3] & 0x30) >> 1);
> + mt[0].x |= (pkt[3] & 0x07);
> + mt[0].y = (pkt[1] << 3) | (pkt[0] & 0x07);
> +
> + mt[1].x = ((pkt[3] & 0x80) << 4);
> + mt[1].x |= ((pkt[4] & 0x80) << 3);
> + mt[1].x |= ((pkt[4] & 0x3F) << 4);
> + mt[1].y = ((pkt[5] & 0x80) << 3);
> + mt[1].y |= ((pkt[5] & 0x3F) << 4);
> +
> + if (pkt_id == V7_PACKET_ID_TWO) {
> + mt[1].x &= ~0x000F;
> + mt[1].y |= 0x000F;
> + } else if (pkt_id == V7_PACKET_ID_MULTI) {
> + mt[1].x &= ~0x003F;
> + mt[1].y &= ~0x0020;
> + mt[1].y |= ((pkt[4] & 0x02) << 4);
> + mt[1].y |= 0x001F;
> + } else if (pkt_id == V7_PACKET_ID_NEW) {
> + mt[1].x &= ~0x003F;
> + mt[1].x |= (pkt[0] & 0x20);
> + mt[1].y |= 0x000F;
> + }
I took the liberty of changing the above to another switch/case...
>
> +static bool alps_check_valid_firmware_id(unsigned char id[])
> +{
> + if (id[0] == 0x73)
> + return true;
> +
> + if (id[0] == 0x88 &&
> + (id[1] == 0x07 || id[1] == 0x08 ||
> + (id[1] & 0xf0) == 0xb0 || (id[1] & 0xf0) == 0xc0))
And split this condition into 1 line per id[1] check...
> + return true;
> +
> + return false;
> +}
> +
And applied and pushed out everything.
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-07-26 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-26 12:13 [PATCH v2] alps: Add support for v7 devices Hans de Goede
2014-07-26 21:09 ` Dmitry Torokhov [this message]
2014-07-26 21:59 ` Hans de Goede
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=20140726210912.GA11800@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-input@vger.kernel.org \
--cc=yunkang.tang@cn.alps.com \
/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).