aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2011-07-07 01:57:39 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-07-07 02:01:17 -0400
commit28d5fd860f97f017573c4cd8f199bab867c50a11 (patch)
treedb678490b92782c78636d4258d3fa74269dd4406 /drivers/input
parentbea9f0ff263e1c2031d76afc21c22ad773f0b163 (diff)
Input: synaptics - process button bits in AGM packets
AGM packets contain valid button bits, too. This patch refactors packet processing to parse button bits in AGM packets. However, they aren't actually used or reported. The point is to more completely process AGM packets, and prepare for future patches that may actually use AGM packet button bits. Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Acked-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/synaptics.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index c5c91bc2cce8..86bd89a28710 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -406,26 +406,10 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
406 memset(hw, 0, sizeof(struct synaptics_hw_state)); 406 memset(hw, 0, sizeof(struct synaptics_hw_state));
407 407
408 if (SYN_MODEL_NEWABS(priv->model_id)) { 408 if (SYN_MODEL_NEWABS(priv->model_id)) {
409 hw->x = (((buf[3] & 0x10) << 8) |
410 ((buf[1] & 0x0f) << 8) |
411 buf[4]);
412 hw->y = (((buf[3] & 0x20) << 7) |
413 ((buf[1] & 0xf0) << 4) |
414 buf[5]);
415
416 hw->z = buf[2];
417 hw->w = (((buf[0] & 0x30) >> 2) | 409 hw->w = (((buf[0] & 0x30) >> 2) |
418 ((buf[0] & 0x04) >> 1) | 410 ((buf[0] & 0x04) >> 1) |
419 ((buf[3] & 0x04) >> 2)); 411 ((buf[3] & 0x04) >> 2));
420 412
421 if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) && hw->w == 2) {
422 /* Gesture packet: (x, y, z) at half resolution */
423 priv->mt.x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
424 priv->mt.y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1;
425 priv->mt.z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
426 return 1;
427 }
428
429 hw->left = (buf[0] & 0x01) ? 1 : 0; 413 hw->left = (buf[0] & 0x01) ? 1 : 0;
430 hw->right = (buf[0] & 0x02) ? 1 : 0; 414 hw->right = (buf[0] & 0x02) ? 1 : 0;
431 415
@@ -448,6 +432,22 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
448 hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; 432 hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
449 } 433 }
450 434
435 if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) && hw->w == 2) {
436 /* Gesture packet: (x, y, z) at half resolution */
437 priv->mt.x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
438 priv->mt.y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1;
439 priv->mt.z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
440 return 1;
441 }
442
443 hw->x = (((buf[3] & 0x10) << 8) |
444 ((buf[1] & 0x0f) << 8) |
445 buf[4]);
446 hw->y = (((buf[3] & 0x20) << 7) |
447 ((buf[1] & 0xf0) << 4) |
448 buf[5]);
449 hw->z = buf[2];
450
451 if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && 451 if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) &&
452 ((buf[0] ^ buf[3]) & 0x02)) { 452 ((buf[0] ^ buf[3]) & 0x02)) {
453 switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { 453 switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {