Skip to content

Commit 9eebed7

Browse files
kendatsubadtor
authored andcommitted
Input: elantech - fix for newer hardware versions (v7)
* Fix version recognition in elantech_set_properties The new hardware reports itself as v7 but the packets' structure is unaltered. * Fix packet type recognition in elantech_packet_check_v4 The bitmask used for v6 is too wide, only the last three bits of the third byte in a packet (packet[3] & 0x03) are actually used to distinguish between packet types. Starting from v7, additional information (to be interpreted) is stored in the remaining bits (packets[3] & 0x1c). In addition, the value stored in (packet[0] & 0x0c) is no longer a constant but contains additional information yet to be deciphered. This change should be backwards compatible with v6 hardware. Additional-author: Giovanni Frigione <[email protected]> Signed-off-by: Matteo Delfino <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent a608026 commit 9eebed7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

drivers/input/mouse/elantech.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -694,18 +694,18 @@ static int elantech_packet_check_v3(struct psmouse *psmouse)
694694
static int elantech_packet_check_v4(struct psmouse *psmouse)
695695
{
696696
unsigned char *packet = psmouse->packet;
697+
unsigned char packet_type = packet[3] & 0x03;
697698

698-
if ((packet[0] & 0x0c) == 0x04 &&
699-
(packet[3] & 0x1f) == 0x11)
699+
switch (packet_type) {
700+
case 0:
701+
return PACKET_V4_STATUS;
702+
703+
case 1:
700704
return PACKET_V4_HEAD;
701705

702-
if ((packet[0] & 0x0c) == 0x04 &&
703-
(packet[3] & 0x1f) == 0x12)
706+
case 2:
704707
return PACKET_V4_MOTION;
705-
706-
if ((packet[0] & 0x0c) == 0x04 &&
707-
(packet[3] & 0x1f) == 0x10)
708-
return PACKET_V4_STATUS;
708+
}
709709

710710
return PACKET_UNKNOWN;
711711
}
@@ -1282,6 +1282,7 @@ static int elantech_set_properties(struct elantech_data *etd)
12821282
etd->hw_version = 3;
12831283
break;
12841284
case 6:
1285+
case 7:
12851286
etd->hw_version = 4;
12861287
break;
12871288
default:

0 commit comments

Comments
 (0)