Skip to content

Commit 4621c96

Browse files
palidtor
authored andcommitted
Input: alps - report pressure of v3 and v7 trackstick
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 <pali.rohar@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 68ef483 commit 4621c96

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/input/mouse/alps.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ static const struct alps_model_info alps_model_data[] = {
139139
};
140140

141141
static const struct alps_protocol_info alps_v3_protocol_data = {
142-
ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT
142+
ALPS_PROTO_V3, 0x8f, 0x8f, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE
143143
};
144144

145145
static const struct alps_protocol_info alps_v3_rushmore_data = {
146-
ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT
146+
ALPS_PROTO_V3_RUSHMORE, 0x8f, 0x8f, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE
147147
};
148148

149149
static const struct alps_protocol_info alps_v4_protocol_data = {
@@ -155,7 +155,7 @@ static const struct alps_protocol_info alps_v5_protocol_data = {
155155
};
156156

157157
static const struct alps_protocol_info alps_v7_protocol_data = {
158-
ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT
158+
ALPS_PROTO_V7, 0x48, 0x48, ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE
159159
};
160160

161161
static const struct alps_protocol_info alps_v8_protocol_data = {
@@ -583,7 +583,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse)
583583

584584
x = (s8)(((packet[0] & 0x20) << 2) | (packet[1] & 0x7f));
585585
y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f));
586-
z = (packet[4] & 0x7c) >> 2;
586+
z = packet[4] & 0x7c;
587587

588588
/*
589589
* 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)
595595

596596
input_report_rel(dev, REL_X, x);
597597
input_report_rel(dev, REL_Y, -y);
598+
input_report_abs(dev, ABS_PRESSURE, z);
598599

599600
/*
600601
* Most ALPS models report the trackstick buttons in the touchpad
@@ -1107,6 +1108,7 @@ static void alps_process_trackstick_packet_v7(struct psmouse *psmouse)
11071108

11081109
input_report_rel(dev2, REL_X, (char)x);
11091110
input_report_rel(dev2, REL_Y, -((char)y));
1111+
input_report_abs(dev2, ABS_PRESSURE, z);
11101112

11111113
psmouse_report_standard_buttons(dev2, packet[1]);
11121114

0 commit comments

Comments
 (0)