/[linux-patches]/genpatches-2.6/trunk/3.0/2635_Input-ALPS-dump-raw-packet-data.patch
Gentoo

Contents of /genpatches-2.6/trunk/3.0/2635_Input-ALPS-dump-raw-packet-data.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1982 - (show annotations) (download)
Wed Sep 28 14:30:19 2011 UTC (6 years, 9 months ago) by mpagano
File size: 4160 byte(s)
Adding ALPS patches for new touchpads from Seth Forshee at Ubuntu
1 From a4eab730f720a2a89be05aef40e35a08a8d85a37 Mon Sep 17 00:00:00 2001
2 From: Seth Forshee <seth.forshee@canonical.com>
3 Date: Wed, 14 Sep 2011 11:40:39 -0500
4 Subject: [PATCH 8/8] Input: ALPS - dump raw packet data
5
6 ---
7 drivers/input/mouse/alps.c | 51 ++++++++++++++++++++++++++-----------------
8 1 files changed, 31 insertions(+), 20 deletions(-)
9
10 diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
11 index ce06b08..90f45ed 100644
12 --- a/drivers/input/mouse/alps.c
13 +++ b/drivers/input/mouse/alps.c
14 @@ -129,6 +129,19 @@ static const struct alps_model_info alps_model_data[] = {
15
16 /* Packet formats are described in Documentation/input/alps.txt */
17
18 +static int alps_dump_packets = 0;
19 +module_param(alps_dump_packets, int, 0644);
20 +
21 +static void alps_packet_dump(unsigned char *packet, int size)
22 +{
23 + int i;
24 +
25 + printk("ALPS data ");
26 + for (i = 0; i < size; i++)
27 + printk("%02hhx ", packet[i]);
28 + printk("\n");
29 +}
30 +
31 static bool alps_is_valid_first_byte(const struct alps_model_info *model,
32 unsigned char data)
33 {
34 @@ -400,7 +413,7 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse)
35 struct alps_data *priv = psmouse->private;
36 unsigned char *packet = psmouse->packet;
37 struct input_dev *dev = priv->dev2;
38 - int x, y, z, left, right, middle;
39 + int x, y, z;
40
41 /* Sanity check packet */
42 if (!(packet[0] & 0x40)) {
43 @@ -419,10 +432,6 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse)
44 y = (s8)(((packet[0] & 0x10) << 3) | (packet[2] & 0x7f));
45 z = (packet[4] & 0x7c) >> 2;
46
47 - left = packet[3] & 0x01;
48 - right = packet[3] & 0x02;
49 - middle = packet[3] & 0x04;
50 -
51 /*
52 * The x and y values tend to be quite large, and when used
53 * alone the trackstick is difficult to use. Scale them down
54 @@ -434,10 +443,6 @@ static void alps_process_trackstick_packet_v3(struct psmouse *psmouse)
55 input_report_rel(dev, REL_X, x);
56 input_report_rel(dev, REL_Y, -y);
57
58 - input_report_key(dev, BTN_LEFT, left);
59 - input_report_key(dev, BTN_RIGHT, right);
60 - input_report_key(dev, BTN_MIDDLE, middle);
61 -
62 input_sync(dev);
63 return;
64 }
65 @@ -447,8 +452,10 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
66 struct alps_data *priv = psmouse->private;
67 unsigned char *packet = psmouse->packet;
68 struct input_dev *dev = psmouse->dev;
69 + struct input_dev *dev2 = priv->dev2;
70 int x, y, z;
71 int left, right, middle;
72 + int stick_left, stick_right, stick_middle;
73 int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
74 int fingers = 0, bmap_fingers;
75 unsigned int x_bitmap, y_bitmap;
76 @@ -500,17 +507,13 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
77
78 priv->multi_packet = 0;
79
80 - /*
81 - * Bits in the upper nibble of byte 3 represent the trackstick
82 - * buttons on some models, but on other models the trackstick
83 - * buttons are reported in the trackstic packets. If we try to
84 - * report the buttons on the trackstick device from here it can
85 - * lead to conflicts, so we treat any buttons reported in the
86 - * touchpad packets as belonging to the touchpad.
87 - */
88 - left = packet[3] & 0x11;
89 - right = packet[3] & 0x22;
90 - middle = packet[3] & 0x44;
91 + left = packet[3] & 0x01;
92 + right = packet[3] & 0x02;
93 + middle = packet[3] & 0x04;
94 +
95 + stick_left = packet[3] & 0x10;
96 + stick_right = packet[3] & 0x20;
97 + stick_middle = packet[3] & 0x40;
98
99 x = ((packet[1] & 0x7f) << 4) | ((packet[4] & 0x30) >> 2) |
100 ((packet[0] & 0x30) >> 4);
101 @@ -560,6 +563,11 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
102 input_report_abs(dev, ABS_PRESSURE, z);
103
104 input_sync(dev);
105 +
106 + input_report_key(dev2, BTN_LEFT, stick_left);
107 + input_report_key(dev2, BTN_RIGHT, stick_right);
108 + input_report_key(dev2, BTN_MIDDLE, stick_middle);
109 + input_sync(dev2);
110 }
111
112 static void alps_process_packet_v3(struct psmouse *psmouse)
113 @@ -621,6 +629,9 @@ static void alps_process_packet(struct psmouse *psmouse)
114 struct alps_data *priv = psmouse->private;
115 const struct alps_model_info *model = priv->i;
116
117 + if (alps_dump_packets)
118 + alps_packet_dump(psmouse->packet, psmouse->pktcnt);
119 +
120 switch (model->proto_version) {
121 case ALPS_PROTO_V1:
122 case ALPS_PROTO_V2:
123 --
124 1.7.4.1
125

  ViewVC Help
Powered by ViewVC 1.1.20