On Wed, Apr 01, 2015 at 05:44:16PM +0200, Fasse wrote:
> This diff adds support for Elantech v3 touchpads using the "crc_enabled"
> integrity check. I tested this patch with my Elantech v3 touchpad using
> firmware version 0x454f00, it now works correctly.
> Other hardware versions should not be affected by this change. I could
> not check if this introduces regression with other firmware versions.
> If you have an elantech touchpad, particularly v3, could you please try
> this diff and see if it causes any issues.
Interesting, thanks.
If you don't hear from anyone else about this please ask me again in
a week from now. I can test on v3 hardware by then but not any earlier.
Please write this as if-else instead of switch:
> @@ -2271,11 +2284,18 @@ pms_proc_elantech_v3(struct pms_softc *s
> * and a tail packet. We report a single event and ignore
> * the tail packet.
> */
> - if ((sc->packet[0] & 0x0c) != 0x04 &&
> - (sc->packet[3] & 0xcf) != 0x02) {
> - /* not the head packet -- ignore */
> - return;
> + switch (elantech->flags & ELANTECH_F_CRC_ENABLED) {
> + case 0:
> + if ((sc->packet[0] & 0x0c) != 0x04 &&
> + (sc->packet[3] & 0xcf) != 0x02) {
> + /* not the head packet -- ignore */
> + return;
> + }
> + case ELANTECH_F_CRC_ENABLED:
> + if ((sc->packet[3] & 0x09) != 0x08)
> + return;
> }