aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hid/hid-magicmouse.c7
-rw-r--r--drivers/hid/hid-wacom.c81
-rw-r--r--drivers/hid/hidraw.c8
-rw-r--r--drivers/hid/usbhid/hid-core.c2
-rw-r--r--drivers/hid/usbhid/hiddev.c2
5 files changed, 58 insertions, 42 deletions
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index f0fbd7bd239e..2ab71758e2e2 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -405,6 +405,13 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h
405 __set_bit(REL_HWHEEL, input->relbit); 405 __set_bit(REL_HWHEEL, input->relbit);
406 } 406 }
407 } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */ 407 } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
408 /* input->keybit is initialized with incorrect button info
409 * for Magic Trackpad. There really is only one physical
410 * button (BTN_LEFT == BTN_MOUSE). Make sure we don't
411 * advertise buttons that don't exist...
412 */
413 __clear_bit(BTN_RIGHT, input->keybit);
414 __clear_bit(BTN_MIDDLE, input->keybit);
408 __set_bit(BTN_MOUSE, input->keybit); 415 __set_bit(BTN_MOUSE, input->keybit);
409 __set_bit(BTN_TOOL_FINGER, input->keybit); 416 __set_bit(BTN_TOOL_FINGER, input->keybit);
410 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit); 417 __set_bit(BTN_TOOL_DOUBLETAP, input->keybit);
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index 72ca689b6474..17bb88f782b6 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -304,11 +304,51 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
304 return 1; 304 return 1;
305} 305}
306 306
307static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
308 struct hid_field *field, struct hid_usage *usage, unsigned long **bit,
309 int *max)
310{
311 struct input_dev *input = hi->input;
312
313 __set_bit(INPUT_PROP_POINTER, input->propbit);
314
315 /* Basics */
316 input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
317
318 __set_bit(REL_WHEEL, input->relbit);
319
320 __set_bit(BTN_TOOL_PEN, input->keybit);
321 __set_bit(BTN_TOUCH, input->keybit);
322 __set_bit(BTN_STYLUS, input->keybit);
323 __set_bit(BTN_STYLUS2, input->keybit);
324 __set_bit(BTN_LEFT, input->keybit);
325 __set_bit(BTN_RIGHT, input->keybit);
326 __set_bit(BTN_MIDDLE, input->keybit);
327
328 /* Pad */
329 input->evbit[0] |= BIT(EV_MSC);
330
331 __set_bit(MSC_SERIAL, input->mscbit);
332
333 __set_bit(BTN_0, input->keybit);
334 __set_bit(BTN_1, input->keybit);
335 __set_bit(BTN_TOOL_FINGER, input->keybit);
336
337 /* Distance, rubber and mouse */
338 __set_bit(BTN_TOOL_RUBBER, input->keybit);
339 __set_bit(BTN_TOOL_MOUSE, input->keybit);
340
341 input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
342 input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
343 input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
344 input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
345
346 return 0;
347}
348
307static int wacom_probe(struct hid_device *hdev, 349static int wacom_probe(struct hid_device *hdev,
308 const struct hid_device_id *id) 350 const struct hid_device_id *id)
309{ 351{
310 struct hid_input *hidinput;
311 struct input_dev *input;
312 struct wacom_data *wdata; 352 struct wacom_data *wdata;
313 int ret; 353 int ret;
314 354
@@ -370,42 +410,6 @@ static int wacom_probe(struct hid_device *hdev,
370 goto err_ac; 410 goto err_ac;
371 } 411 }
372#endif 412#endif
373 hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
374 input = hidinput->input;
375
376 __set_bit(INPUT_PROP_POINTER, input->propbit);
377
378 /* Basics */
379 input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
380
381 __set_bit(REL_WHEEL, input->relbit);
382
383 __set_bit(BTN_TOOL_PEN, input->keybit);
384 __set_bit(BTN_TOUCH, input->keybit);
385 __set_bit(BTN_STYLUS, input->keybit);
386 __set_bit(BTN_STYLUS2, input->keybit);
387 __set_bit(BTN_LEFT, input->keybit);
388 __set_bit(BTN_RIGHT, input->keybit);
389 __set_bit(BTN_MIDDLE, input->keybit);
390
391 /* Pad */
392 input->evbit[0] |= BIT(EV_MSC);
393
394 __set_bit(MSC_SERIAL, input->mscbit);
395
396 __set_bit(BTN_0, input->keybit);
397 __set_bit(BTN_1, input->keybit);
398 __set_bit(BTN_TOOL_FINGER, input->keybit);
399
400 /* Distance, rubber and mouse */
401 __set_bit(BTN_TOOL_RUBBER, input->keybit);
402 __set_bit(BTN_TOOL_MOUSE, input->keybit);
403
404 input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
405 input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
406 input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
407 input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
408
409 return 0; 413 return 0;
410 414
411#ifdef CONFIG_HID_WACOM_POWER_SUPPLY 415#ifdef CONFIG_HID_WACOM_POWER_SUPPLY
@@ -448,6 +452,7 @@ static struct hid_driver wacom_driver = {
448 .probe = wacom_probe, 452 .probe = wacom_probe,
449 .remove = wacom_remove, 453 .remove = wacom_remove,
450 .raw_event = wacom_raw_event, 454 .raw_event = wacom_raw_event,
455 .input_mapped = wacom_input_mapped,
451}; 456};
452 457
453static int __init wacom_init(void) 458static int __init wacom_init(void)
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index c79578b5a788..6d65d4e35120 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -272,8 +272,10 @@ static int hidraw_open(struct inode *inode, struct file *file)
272 dev = hidraw_table[minor]; 272 dev = hidraw_table[minor];
273 if (!dev->open++) { 273 if (!dev->open++) {
274 err = hid_hw_power(dev->hid, PM_HINT_FULLON); 274 err = hid_hw_power(dev->hid, PM_HINT_FULLON);
275 if (err < 0) 275 if (err < 0) {
276 dev->open--;
276 goto out_unlock; 277 goto out_unlock;
278 }
277 279
278 err = hid_hw_open(dev->hid); 280 err = hid_hw_open(dev->hid);
279 if (err < 0) { 281 if (err < 0) {
@@ -510,13 +512,12 @@ void hidraw_disconnect(struct hid_device *hid)
510{ 512{
511 struct hidraw *hidraw = hid->hidraw; 513 struct hidraw *hidraw = hid->hidraw;
512 514
515 mutex_lock(&minors_lock);
513 hidraw->exist = 0; 516 hidraw->exist = 0;
514 517
515 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor)); 518 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
516 519
517 mutex_lock(&minors_lock);
518 hidraw_table[hidraw->minor] = NULL; 520 hidraw_table[hidraw->minor] = NULL;
519 mutex_unlock(&minors_lock);
520 521
521 if (hidraw->open) { 522 if (hidraw->open) {
522 hid_hw_close(hid); 523 hid_hw_close(hid);
@@ -524,6 +525,7 @@ void hidraw_disconnect(struct hid_device *hid)
524 } else { 525 } else {
525 kfree(hidraw); 526 kfree(hidraw);
526 } 527 }
528 mutex_unlock(&minors_lock);
527} 529}
528EXPORT_SYMBOL_GPL(hidraw_disconnect); 530EXPORT_SYMBOL_GPL(hidraw_disconnect);
529 531
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ad978f5748d3..77e705c2209c 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1270,7 +1270,7 @@ static void hid_cancel_delayed_stuff(struct usbhid_device *usbhid)
1270 1270
1271static void hid_cease_io(struct usbhid_device *usbhid) 1271static void hid_cease_io(struct usbhid_device *usbhid)
1272{ 1272{
1273 del_timer(&usbhid->io_retry); 1273 del_timer_sync(&usbhid->io_retry);
1274 usb_kill_urb(usbhid->urbin); 1274 usb_kill_urb(usbhid->urbin);
1275 usb_kill_urb(usbhid->urbctrl); 1275 usb_kill_urb(usbhid->urbctrl);
1276 usb_kill_urb(usbhid->urbout); 1276 usb_kill_urb(usbhid->urbout);
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 7c1188b53c3e..4ef02b269a71 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -641,6 +641,8 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
641 struct usb_device *dev = hid_to_usb_dev(hid); 641 struct usb_device *dev = hid_to_usb_dev(hid);
642 struct usbhid_device *usbhid = hid->driver_data; 642 struct usbhid_device *usbhid = hid->driver_data;
643 643
644 memset(&dinfo, 0, sizeof(dinfo));
645
644 dinfo.bustype = BUS_USB; 646 dinfo.bustype = BUS_USB;
645 dinfo.busnum = dev->bus->busnum; 647 dinfo.busnum = dev->bus->busnum;
646 dinfo.devnum = dev->devnum; 648 dinfo.devnum = dev->devnum;