From 4621c9660459cd256e395e129bce6cd0f79a8ca3 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Mon, 26 Mar 2018 15:31:58 -0700 Subject: Input: alps - report pressure of v3 and v7 trackstick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ALPS v3 and v7 packet formats reports trackstick pressure. This information is already parsed in unused "z" variable. ALPS SS4 S2 devices already reports trackstick pressure as ABS_PRESSURE attribute, therefore reports pressure in the same way also for v3 and v7. This patch also updates parsing v3 pressure information, it is also stored in 7 bits. Signed-off-by: Pali Rohár Signed-off-by: Dmitry Torokhov --- drivers/input/mouse/alps.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers/input/mouse') diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index f9c7f2452264..f0b1060a7fee 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -139,11 +139,11 @@ static const struct alps_model_info alps_model_data[] = { }; static const struct alps_protocol_info alps_v3_protocol_data = { - ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT + ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE }; static const struct alps_protocol_info alps_v3_rushmore_data = { - ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT + ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE }; static const struct alps_protocol_info alps_v4_protocol_data = { @@ -155,7 +155,7 @@ static const struct alps_protocol_info alps_v5_protocol_data = { }; static const struct alps_protocol_info alps_v7_protocol_data = { - ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT + ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE }; static const struct alps_protocol_info alps_v8_protocol_data = { @@ -583,7 +583,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse) x = (s8)(((packet[0] & 0x20) << 2) | (packet[1] & 0x7f)); y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f)); - z = (packet[4] & 0x7c) >> 2; + z = packet[4] & 0x7c; /* * The x and y values tend to be quite large, and when used @@ -595,6 +595,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse) input_report_rel(dev, REL_X, x); input_report_rel(dev, REL_Y, -y); + input_report_abs(dev, ABS_PRESSURE, z); /* * Most ALPS models report the trackstick buttons in the touchpad @@ -1107,6 +1108,7 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse) input_report_rel(dev2, REL_X, (char)x); input_report_rel(dev2, REL_Y, -((char)y)); + input_report_abs(dev2, ABS_PRESSURE, z); psmouse_report_standard_buttons(dev2, packet[1]); -- cgit v1.2.3-59-g8ed1b