提交 f941c705 编写于 作者: É Éric Piel 提交者: Dmitry Torokhov

Input: elantech - export pressure and width when supported

Using the info of the Dell/Ubuntu driver, described in the protocol
document, report both width and pressure when pressing 1 and 3
fingers, for the versions of the touchpad which support it.
Signed-off-by: NÉric Piel <eric.piel@tremplin-utc.net>
Reviewed-by: NHenrik Rydberg <rydberg@euromail.se>
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 71c6d188
...@@ -248,9 +248,10 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse) ...@@ -248,9 +248,10 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
*/ */
static void elantech_report_absolute_v2(struct psmouse *psmouse) static void elantech_report_absolute_v2(struct psmouse *psmouse)
{ {
struct elantech_data *etd = psmouse->private;
struct input_dev *dev = psmouse->dev; struct input_dev *dev = psmouse->dev;
unsigned char *packet = psmouse->packet; unsigned char *packet = psmouse->packet;
int fingers, x1, y1, x2, y2; int fingers, x1, y1, x2, y2, width = 0, pres = 0;
/* byte 0: n1 n0 . . . . R L */ /* byte 0: n1 n0 . . . . R L */
fingers = (packet[0] & 0xc0) >> 6; fingers = (packet[0] & 0xc0) >> 6;
...@@ -278,6 +279,8 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) ...@@ -278,6 +279,8 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
*/ */
input_report_abs(dev, ABS_Y, input_report_abs(dev, ABS_Y,
ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5])); ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5]));
pres = (packet[1] & 0xf0) | ((packet[4] & 0xf0) >> 4);
width = ((packet[0] & 0x30) >> 2) | ((packet[3] & 0x30) >> 4);
break; break;
case 2: case 2:
...@@ -311,6 +314,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) ...@@ -311,6 +314,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
input_report_abs(dev, ABS_HAT0Y, y1); input_report_abs(dev, ABS_HAT0Y, y1);
input_report_abs(dev, ABS_HAT1X, x2); input_report_abs(dev, ABS_HAT1X, x2);
input_report_abs(dev, ABS_HAT1Y, y2); input_report_abs(dev, ABS_HAT1Y, y2);
/* Unknown so just report sensible values */
pres = 127;
width = 7;
break; break;
} }
...@@ -320,6 +327,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) ...@@ -320,6 +327,10 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)
input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4); input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4);
input_report_key(dev, BTN_LEFT, packet[0] & 0x01); input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
if (etd->reports_pressure) {
input_report_abs(dev, ABS_PRESSURE, pres);
input_report_abs(dev, ABS_TOOL_WIDTH, width);
}
input_sync(dev); input_sync(dev);
} }
...@@ -478,6 +489,12 @@ static void elantech_set_input_params(struct psmouse *psmouse) ...@@ -478,6 +489,12 @@ static void elantech_set_input_params(struct psmouse *psmouse)
__set_bit(BTN_TOOL_QUADTAP, dev->keybit); __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0); input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0);
input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0); input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0);
if (etd->reports_pressure) {
input_set_abs_params(dev, ABS_PRESSURE, ETP_PMIN_V2,
ETP_PMAX_V2, 0, 0);
input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
ETP_WMAX_V2, 0, 0);
}
input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); input_set_abs_params(dev, ABS_HAT0X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0);
input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0); input_set_abs_params(dev, ABS_HAT0Y, ETP_2FT_YMIN, ETP_2FT_YMAX, 0, 0);
input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0); input_set_abs_params(dev, ABS_HAT1X, ETP_2FT_XMIN, ETP_2FT_XMAX, 0, 0);
...@@ -725,6 +742,10 @@ int elantech_init(struct psmouse *psmouse) ...@@ -725,6 +742,10 @@ int elantech_init(struct psmouse *psmouse)
etd->debug = 1; etd->debug = 1;
/* Don't know how to do parity checking for version 2 */ /* Don't know how to do parity checking for version 2 */
etd->paritycheck = 0; etd->paritycheck = 0;
if (etd->fw_version >= 0x020800)
etd->reports_pressure = true;
} else { } else {
etd->hw_version = 1; etd->hw_version = 1;
etd->paritycheck = 1; etd->paritycheck = 1;
......
...@@ -77,6 +77,11 @@ ...@@ -77,6 +77,11 @@
#define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2) #define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2)
#define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2) #define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2)
#define ETP_PMIN_V2 0
#define ETP_PMAX_V2 255
#define ETP_WMIN_V2 0
#define ETP_WMAX_V2 15
/* /*
* For two finger touches the coordinate of each finger gets reported * For two finger touches the coordinate of each finger gets reported
* separately but with reduced resolution. * separately but with reduced resolution.
...@@ -102,6 +107,7 @@ struct elantech_data { ...@@ -102,6 +107,7 @@ struct elantech_data {
unsigned char capabilities; unsigned char capabilities;
bool paritycheck; bool paritycheck;
bool jumpy_cursor; bool jumpy_cursor;
bool reports_pressure;
unsigned char hw_version; unsigned char hw_version;
unsigned int fw_version; unsigned int fw_version;
unsigned int single_finger_reports; unsigned int single_finger_reports;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册