Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297787
b: refs/heads/master
c: 727f9b4
h: refs/heads/master
i:
  297785: 9e6da3a
  297783: e66e492
v: v3
  • Loading branch information
Oskari Saarenmaa authored and Dmitry Torokhov committed Mar 26, 2012
1 parent 3039cd0 commit aa5c87c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b85f73d0461188aa397d428e6c53419ebfd86b4
refs/heads/master: 727f9b480754dfcb82e36d431e85984893011b79
43 changes: 34 additions & 9 deletions trunk/drivers/input/mouse/sentelic.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#define FSP_CMD_TIMEOUT 200
#define FSP_CMD_TIMEOUT2 30

#define GET_ABS_X(packet) ((packet[1] << 2) | ((packet[3] >> 2) & 0x03))
#define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03))

/** Driver version. */
static const char fsp_drv_ver[] = "1.0.0-K";

Expand Down Expand Up @@ -619,18 +622,40 @@ static struct attribute_group fsp_attribute_group = {
.attrs = fsp_attributes,
};

#ifdef FSP_DEBUG
static void fsp_packet_debug(unsigned char packet[])
#ifdef FSP_DEBUG
static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[])
{
static unsigned int ps2_packet_cnt;
static unsigned int ps2_last_second;
unsigned int jiffies_msec;
const char *packet_type = "UNKNOWN";
unsigned short abs_x = 0, abs_y = 0;

/* Interpret & dump the packet data. */
switch (packet[0] >> FSP_PKT_TYPE_SHIFT) {
case FSP_PKT_TYPE_ABS:
packet_type = "Absolute";
abs_x = GET_ABS_X(packet);
abs_y = GET_ABS_Y(packet);
break;
case FSP_PKT_TYPE_NORMAL:
packet_type = "Normal";
break;
case FSP_PKT_TYPE_NOTIFY:
packet_type = "Notify";
break;
case FSP_PKT_TYPE_NORMAL_OPC:
packet_type = "Normal-OPC";
break;
}

ps2_packet_cnt++;
jiffies_msec = jiffies_to_msecs(jiffies);
psmouse_dbg(psmouse,
"%08dms PS/2 packets: %02x, %02x, %02x, %02x\n",
jiffies_msec, packet[0], packet[1], packet[2], packet[3]);
"%08dms %s packets: %02x, %02x, %02x, %02x; "
"abs_x: %d, abs_y: %d\n",
jiffies_msec, packet_type,
packet[0], packet[1], packet[2], packet[3], abs_x, abs_y);

if (jiffies_msec - ps2_last_second > 1000) {
psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt);
Expand All @@ -639,7 +664,7 @@ static void fsp_packet_debug(unsigned char packet[])
}
}
#else
static void fsp_packet_debug(unsigned char packet[])
static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[])
{
}
#endif
Expand Down Expand Up @@ -671,10 +696,12 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
* Full packet accumulated, process it
*/

fsp_packet_debug(psmouse, packet);

switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) {
case FSP_PKT_TYPE_ABS:
abs_x = (packet[1] << 2) | ((packet[3] >> 2) & 0x03);
abs_y = (packet[2] << 2) | (packet[3] & 0x03);
abs_x = GET_ABS_X(packet);
abs_y = GET_ABS_Y(packet);

if (packet[0] & FSP_PB0_MFMC) {
/*
Expand Down Expand Up @@ -785,8 +812,6 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)

input_sync(dev);

fsp_packet_debug(packet);

return PSMOUSE_FULL_PACKET;
}

Expand Down

0 comments on commit aa5c87c

Please sign in to comment.