@@ -707,7 +707,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
struct fsp_data *ad = psmouse->private;
unsigned char *packet = psmouse->packet;
unsigned char button_status = 0, lscroll = 0, rscroll = 0;
- unsigned short abs_x, abs_y, fgrs = 0;
+ unsigned short abs_x, abs_y, fgrs;
int rel_x, rel_y;
if (psmouse->pktcnt < 4)
@@ -721,64 +721,100 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) {
case FSP_PKT_TYPE_ABS:
+ if ((packet[0] == 0x48 || packet[0] == 0x49) &&
+ packet[1] == 0 && packet[2] == 0) {
+ /*
+ * filtering out erratic movement which will cause
+ * unexpected cursor jumping to the top-left corner
+ */
+ packet[3] &= 0xf0;
+ }
abs_x = GET_ABS_X(packet);
abs_y = GET_ABS_Y(packet);
- if (packet[0] & FSP_PB0_MFMC) {
+ if (!IS_MFMC(packet[0]) && (packet[0] & (FSP_PB0_LBTN |
+ FSP_PB0_PHY_BTN)) == FSP_PB0_LBTN) {
/*
- * MFMC packet: assume that there are two fingers on
- * pad
+ * On-pad click in SFAC mode should be handled
+ * by userspace. On-pad clicks in MFMC mode
+ * are real clickpad clicks, and not ignored.
*/
- fgrs = 2;
+ packet[0] &= ~FSP_PB0_LBTN;
+ }
+ if (abs_x == 0 || abs_y == 0) {
+ /*
+ * workaround for buggy firmware which sends zero
+ * coordinates even if there is finger on pad
+ */
+ if (!IS_MFMC(packet[0])) {
+ /* don't report bad movement */
+ fgrs = 0;
+ } else {
+ /*
+ * ignore finger up event for multiple finger
+ * scenario
+ */
+ return PSMOUSE_FULL_PACKET;
+ }
+ } else {
+ /* finger(s) down */
+ if (!IS_MFMC(packet[0])) {
+ /* SFAC, MFMC CPB packet */
+ fgrs = 1;
- /* MFMC packet */
- if (packet[0] & FSP_PB0_MFMC_FGR2) {
- /* 2nd finger */
- if (ad->last_mt_fgr == 2) {
+ /* no multi-finger information */
+ ad->last_mt_fgr = 0;
+
+ fsp_set_slot(dev, 0, true, abs_x, abs_y);
+ fsp_set_slot(dev, 1, false, 0, 0);
+ } else if (IS_MFMC_FGR1(packet[0])) {
+ /* MFMC 1st finger */
+ if (ad->last_mt_fgr == 1) {
/*
* workaround for buggy firmware
* which doesn't clear MFMC bit if
- * the 1st finger is up
+ * the 2nd finger is up
*/
fgrs = 1;
- fsp_set_slot(dev, 0, false, 0, 0);
- }
- ad->last_mt_fgr = 2;
+ fsp_set_slot(dev, 0, true,
+ abs_x, abs_y);
+ fsp_set_slot(dev, 1, false, 0, 0);
+ } else {
+ fgrs = 2;
+ ad->last_mt_fgr = 1;
- fsp_set_slot(dev, 1, fgrs == 2, abs_x, abs_y);
+ /*
+ * accumulate the coordaintes and
+ * proceed to the next run
+ */
+ ad->mfmc_x1 = abs_x;
+ ad->mfmc_y1 = abs_y;
+ }
} else {
- /* 1st finger */
- if (ad->last_mt_fgr == 1) {
+ /* MFMC 2nd finger */
+ if (ad->last_mt_fgr == 2) {
/*
* workaround for buggy firmware
* which doesn't clear MFMC bit if
- * the 2nd finger is up
+ * the 1st finger is up
*/
fgrs = 1;
- fsp_set_slot(dev, 1, false, 0, 0);
+ fsp_set_slot(dev, 0, false, 0, 0);
+ fsp_set_slot(dev, 1, true,
+ abs_x, abs_y);
+ } else {
+ fgrs = 2;
+ ad->last_mt_fgr = 2;
+
+ /* report both fingers' coordinate */
+ fsp_set_slot(dev, 1, true,
+ abs_x, abs_y);
+ abs_x = ad->mfmc_x1;
+ abs_y = ad->mfmc_y1;
+ fsp_set_slot(dev, 0, true,
+ abs_x, abs_y);
}
- ad->last_mt_fgr = 1;
- fsp_set_slot(dev, 0, fgrs != 0, abs_x, abs_y);
- }
- } else {
- /* SFAC packet */
- if ((packet[0] & (FSP_PB0_LBTN|FSP_PB0_PHY_BTN)) ==
- FSP_PB0_LBTN) {
- /* On-pad click in SFAC mode should be handled
- * by userspace. On-pad clicks in MFMC mode
- * are real clickpad clicks, and not ignored.
- */
- packet[0] &= ~FSP_PB0_LBTN;
}
-
- /* no multi-finger information */
- ad->last_mt_fgr = 0;
-
- if (abs_x != 0 && abs_y != 0)
- fgrs = 1;
-
- fsp_set_slot(dev, 0, fgrs > 0, abs_x, abs_y);
- fsp_set_slot(dev, 1, false, 0, 0);
}
if (fgrs > 0) {
input_report_abs(dev, ABS_X, abs_x);