diff options
-rw-r--r-- | drivers/input/mouse/alps.c | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index f4ba73b81d31..942ee08ce6b4 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -576,20 +576,22 @@ static int alps_decode_pinnacle(struct alps_fields *f, unsigned char *p, | |||
576 | f->first_mp = !!(p[4] & 0x40); | 576 | f->first_mp = !!(p[4] & 0x40); |
577 | f->is_mp = !!(p[0] & 0x40); | 577 | f->is_mp = !!(p[0] & 0x40); |
578 | 578 | ||
579 | f->fingers = (p[5] & 0x3) + 1; | 579 | if (f->is_mp) { |
580 | f->x_map = ((p[4] & 0x7e) << 8) | | 580 | f->fingers = (p[5] & 0x3) + 1; |
581 | ((p[1] & 0x7f) << 2) | | 581 | f->x_map = ((p[4] & 0x7e) << 8) | |
582 | ((p[0] & 0x30) >> 4); | 582 | ((p[1] & 0x7f) << 2) | |
583 | f->y_map = ((p[3] & 0x70) << 4) | | 583 | ((p[0] & 0x30) >> 4); |
584 | ((p[2] & 0x7f) << 1) | | 584 | f->y_map = ((p[3] & 0x70) << 4) | |
585 | (p[4] & 0x01); | 585 | ((p[2] & 0x7f) << 1) | |
586 | 586 | (p[4] & 0x01); | |
587 | f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) | | 587 | } else { |
588 | ((p[0] & 0x30) >> 4); | 588 | f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) | |
589 | f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f); | 589 | ((p[0] & 0x30) >> 4); |
590 | f->pressure = p[5] & 0x7f; | 590 | f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f); |
591 | f->pressure = p[5] & 0x7f; | ||
591 | 592 | ||
592 | alps_decode_buttons_v3(f, p); | 593 | alps_decode_buttons_v3(f, p); |
594 | } | ||
593 | 595 | ||
594 | return 0; | 596 | return 0; |
595 | } | 597 | } |
@@ -600,22 +602,24 @@ static int alps_decode_rushmore(struct alps_fields *f, unsigned char *p, | |||
600 | f->first_mp = !!(p[4] & 0x40); | 602 | f->first_mp = !!(p[4] & 0x40); |
601 | f->is_mp = !!(p[5] & 0x40); | 603 | f->is_mp = !!(p[5] & 0x40); |
602 | 604 | ||
603 | f->fingers = max((p[5] & 0x3), ((p[5] >> 2) & 0x3)) + 1; | 605 | if (f->is_mp) { |
604 | f->x_map = ((p[5] & 0x10) << 11) | | 606 | f->fingers = max((p[5] & 0x3), ((p[5] >> 2) & 0x3)) + 1; |
605 | ((p[4] & 0x7e) << 8) | | 607 | f->x_map = ((p[5] & 0x10) << 11) | |
606 | ((p[1] & 0x7f) << 2) | | 608 | ((p[4] & 0x7e) << 8) | |
607 | ((p[0] & 0x30) >> 4); | 609 | ((p[1] & 0x7f) << 2) | |
608 | f->y_map = ((p[5] & 0x20) << 6) | | 610 | ((p[0] & 0x30) >> 4); |
609 | ((p[3] & 0x70) << 4) | | 611 | f->y_map = ((p[5] & 0x20) << 6) | |
610 | ((p[2] & 0x7f) << 1) | | 612 | ((p[3] & 0x70) << 4) | |
611 | (p[4] & 0x01); | 613 | ((p[2] & 0x7f) << 1) | |
612 | 614 | (p[4] & 0x01); | |
613 | f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) | | 615 | } else { |
614 | ((p[0] & 0x30) >> 4); | 616 | f->st.x = ((p[1] & 0x7f) << 4) | ((p[4] & 0x30) >> 2) | |
615 | f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f); | 617 | ((p[0] & 0x30) >> 4); |
616 | f->pressure = p[5] & 0x7f; | 618 | f->st.y = ((p[2] & 0x7f) << 4) | (p[4] & 0x0f); |
617 | 619 | f->pressure = p[5] & 0x7f; | |
618 | alps_decode_buttons_v3(f, p); | 620 | |
621 | alps_decode_buttons_v3(f, p); | ||
622 | } | ||
619 | 623 | ||
620 | return 0; | 624 | return 0; |
621 | } | 625 | } |