aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-wacom.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/hid/hid-wacom.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/hid/hid-wacom.c')
-rw-r--r--drivers/hid/hid-wacom.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 747542172242..f947d8337e21 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -21,6 +21,7 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/hid.h> 22#include <linux/hid.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/slab.h>
24 25
25#include "hid-ids.h" 26#include "hid-ids.h"
26 27
@@ -142,6 +143,7 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
142 wdata->butstate = rw; 143 wdata->butstate = rw;
143 input_report_key(input, BTN_0, rw & 0x02); 144 input_report_key(input, BTN_0, rw & 0x02);
144 input_report_key(input, BTN_1, rw & 0x01); 145 input_report_key(input, BTN_1, rw & 0x01);
146 input_report_key(input, BTN_TOOL_FINGER, 0xf0);
145 input_event(input, EV_MSC, MSC_SERIAL, 0xf0); 147 input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
146 input_sync(input); 148 input_sync(input);
147 } 149 }
@@ -155,7 +157,9 @@ static int wacom_probe(struct hid_device *hdev,
155 struct hid_input *hidinput; 157 struct hid_input *hidinput;
156 struct input_dev *input; 158 struct input_dev *input;
157 struct wacom_data *wdata; 159 struct wacom_data *wdata;
160 char rep_data[2];
158 int ret; 161 int ret;
162 int limit;
159 163
160 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); 164 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
161 if (wdata == NULL) { 165 if (wdata == NULL) {
@@ -165,6 +169,7 @@ static int wacom_probe(struct hid_device *hdev,
165 169
166 hid_set_drvdata(hdev, wdata); 170 hid_set_drvdata(hdev, wdata);
167 171
172 /* Parse the HID report now */
168 ret = hid_parse(hdev); 173 ret = hid_parse(hdev);
169 if (ret) { 174 if (ret) {
170 dev_err(&hdev->dev, "parse failed\n"); 175 dev_err(&hdev->dev, "parse failed\n");
@@ -177,6 +182,31 @@ static int wacom_probe(struct hid_device *hdev,
177 goto err_free; 182 goto err_free;
178 } 183 }
179 184
185 /*
186 * Note that if the raw queries fail, it's not a hard failure and it
187 * is safe to continue
188 */
189
190 /* Set Wacom mode2 */
191 rep_data[0] = 0x03; rep_data[1] = 0x00;
192 limit = 3;
193 do {
194 ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
195 HID_FEATURE_REPORT);
196 } while (ret < 0 && limit-- > 0);
197 if (ret < 0)
198 dev_warn(&hdev->dev, "failed to poke device #1, %d\n", ret);
199
200 /* 0x06 - high reporting speed, 0x05 - low speed */
201 rep_data[0] = 0x06; rep_data[1] = 0x00;
202 limit = 3;
203 do {
204 ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
205 HID_FEATURE_REPORT);
206 } while (ret < 0 && limit-- > 0);
207 if (ret < 0)
208 dev_warn(&hdev->dev, "failed to poke device #2, %d\n", ret);
209
180 hidinput = list_entry(hdev->inputs.next, struct hid_input, list); 210 hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
181 input = hidinput->input; 211 input = hidinput->input;
182 212
@@ -196,6 +226,9 @@ static int wacom_probe(struct hid_device *hdev,
196 /* Pad */ 226 /* Pad */
197 input->evbit[0] |= BIT(EV_MSC); 227 input->evbit[0] |= BIT(EV_MSC);
198 input->mscbit[0] |= BIT(MSC_SERIAL); 228 input->mscbit[0] |= BIT(MSC_SERIAL);
229 set_bit(BTN_0, input->keybit);
230 set_bit(BTN_1, input->keybit);
231 set_bit(BTN_TOOL_FINGER, input->keybit);
199 232
200 /* Distance, rubber and mouse */ 233 /* Distance, rubber and mouse */
201 input->absbit[0] |= BIT(ABS_DISTANCE); 234 input->absbit[0] |= BIT(ABS_DISTANCE);
@@ -244,7 +277,6 @@ static int __init wacom_init(void)
244 ret = hid_register_driver(&wacom_driver); 277 ret = hid_register_driver(&wacom_driver);
245 if (ret) 278 if (ret)
246 printk(KERN_ERR "can't register wacom driver\n"); 279 printk(KERN_ERR "can't register wacom driver\n");
247 printk(KERN_ERR "wacom driver registered\n");
248 return ret; 280 return ret;
249} 281}
250 282