diff options
author | Oskari Saarenmaa <os@ohmu.fi> | 2012-03-25 20:17:27 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-03-25 20:18:18 -0400 |
commit | 727f9b480754dfcb82e36d431e85984893011b79 (patch) | |
tree | 33ff1f4d3f1c44b60214f5af27b62ff0e6e52629 /drivers/input | |
parent | 7b85f73d0461188aa397d428e6c53419ebfd86b4 (diff) |
Input: sentelic - improve packet debugging information
Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
Signed-off-by: Tai-hwa Liang <avatar@sentelic.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/sentelic.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index d6bc5a0b2865..a977bfaa6821 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -37,6 +37,9 @@ | |||
37 | #define FSP_CMD_TIMEOUT 200 | 37 | #define FSP_CMD_TIMEOUT 200 |
38 | #define FSP_CMD_TIMEOUT2 30 | 38 | #define FSP_CMD_TIMEOUT2 30 |
39 | 39 | ||
40 | #define GET_ABS_X(packet) ((packet[1] << 2) | ((packet[3] >> 2) & 0x03)) | ||
41 | #define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) | ||
42 | |||
40 | /** Driver version. */ | 43 | /** Driver version. */ |
41 | static const char fsp_drv_ver[] = "1.0.0-K"; | 44 | static const char fsp_drv_ver[] = "1.0.0-K"; |
42 | 45 | ||
@@ -619,18 +622,40 @@ static struct attribute_group fsp_attribute_group = { | |||
619 | .attrs = fsp_attributes, | 622 | .attrs = fsp_attributes, |
620 | }; | 623 | }; |
621 | 624 | ||
622 | #ifdef FSP_DEBUG | 625 | #ifdef FSP_DEBUG |
623 | static void fsp_packet_debug(unsigned char packet[]) | 626 | static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) |
624 | { | 627 | { |
625 | static unsigned int ps2_packet_cnt; | 628 | static unsigned int ps2_packet_cnt; |
626 | static unsigned int ps2_last_second; | 629 | static unsigned int ps2_last_second; |
627 | unsigned int jiffies_msec; | 630 | unsigned int jiffies_msec; |
631 | const char *packet_type = "UNKNOWN"; | ||
632 | unsigned short abs_x = 0, abs_y = 0; | ||
633 | |||
634 | /* Interpret & dump the packet data. */ | ||
635 | switch (packet[0] >> FSP_PKT_TYPE_SHIFT) { | ||
636 | case FSP_PKT_TYPE_ABS: | ||
637 | packet_type = "Absolute"; | ||
638 | abs_x = GET_ABS_X(packet); | ||
639 | abs_y = GET_ABS_Y(packet); | ||
640 | break; | ||
641 | case FSP_PKT_TYPE_NORMAL: | ||
642 | packet_type = "Normal"; | ||
643 | break; | ||
644 | case FSP_PKT_TYPE_NOTIFY: | ||
645 | packet_type = "Notify"; | ||
646 | break; | ||
647 | case FSP_PKT_TYPE_NORMAL_OPC: | ||
648 | packet_type = "Normal-OPC"; | ||
649 | break; | ||
650 | } | ||
628 | 651 | ||
629 | ps2_packet_cnt++; | 652 | ps2_packet_cnt++; |
630 | jiffies_msec = jiffies_to_msecs(jiffies); | 653 | jiffies_msec = jiffies_to_msecs(jiffies); |
631 | psmouse_dbg(psmouse, | 654 | psmouse_dbg(psmouse, |
632 | "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n", | 655 | "%08dms %s packets: %02x, %02x, %02x, %02x; " |
633 | jiffies_msec, packet[0], packet[1], packet[2], packet[3]); | 656 | "abs_x: %d, abs_y: %d\n", |
657 | jiffies_msec, packet_type, | ||
658 | packet[0], packet[1], packet[2], packet[3], abs_x, abs_y); | ||
634 | 659 | ||
635 | if (jiffies_msec - ps2_last_second > 1000) { | 660 | if (jiffies_msec - ps2_last_second > 1000) { |
636 | psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt); | 661 | psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt); |
@@ -639,7 +664,7 @@ static void fsp_packet_debug(unsigned char packet[]) | |||
639 | } | 664 | } |
640 | } | 665 | } |
641 | #else | 666 | #else |
642 | static void fsp_packet_debug(unsigned char packet[]) | 667 | static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) |
643 | { | 668 | { |
644 | } | 669 | } |
645 | #endif | 670 | #endif |
@@ -671,10 +696,12 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
671 | * Full packet accumulated, process it | 696 | * Full packet accumulated, process it |
672 | */ | 697 | */ |
673 | 698 | ||
699 | fsp_packet_debug(psmouse, packet); | ||
700 | |||
674 | switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { | 701 | switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { |
675 | case FSP_PKT_TYPE_ABS: | 702 | case FSP_PKT_TYPE_ABS: |
676 | abs_x = (packet[1] << 2) | ((packet[3] >> 2) & 0x03); | 703 | abs_x = GET_ABS_X(packet); |
677 | abs_y = (packet[2] << 2) | (packet[3] & 0x03); | 704 | abs_y = GET_ABS_Y(packet); |
678 | 705 | ||
679 | if (packet[0] & FSP_PB0_MFMC) { | 706 | if (packet[0] & FSP_PB0_MFMC) { |
680 | /* | 707 | /* |
@@ -785,8 +812,6 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
785 | 812 | ||
786 | input_sync(dev); | 813 | input_sync(dev); |
787 | 814 | ||
788 | fsp_packet_debug(packet); | ||
789 | |||
790 | return PSMOUSE_FULL_PACKET; | 815 | return PSMOUSE_FULL_PACKET; |
791 | } | 816 | } |
792 | 817 | ||