aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-multitouch.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2013-03-27 09:02:27 -0400
committerJiri Kosina <jkosina@suse.cz>2013-03-27 09:02:27 -0400
commitb3fecf8cab6441527ab057c99d7e6a6d7f6713e5 (patch)
treed327499840a25fbd1f81e49d5cb6769bdad382f5 /drivers/hid/hid-multitouch.c
parent5b62efd8250d6a751c31d1972e96bfccd19c4679 (diff)
parent83a44ac8bf4a8e6cbbf0c00ff281a482778f708a (diff)
Merge branch 'for-3.10/hid-driver-transport-cleanups' into for-3.10/mt-hybrid-finger-pen
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r--drivers/hid/hid-multitouch.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 3f6849ddd29c..1f544a48507d 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -2,8 +2,9 @@
2 * HID driver for multitouch panels 2 * HID driver for multitouch panels
3 * 3 *
4 * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr> 4 * Copyright (c) 2010-2012 Stephane Chatty <chatty@enac.fr>
5 * Copyright (c) 2010-2012 Benjamin Tissoires <benjamin.tissoires@gmail.com> 5 * Copyright (c) 2010-2013 Benjamin Tissoires <benjamin.tissoires@gmail.com>
6 * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France 6 * Copyright (c) 2010-2012 Ecole Nationale de l'Aviation Civile, France
7 * Copyright (c) 2012-2013 Red Hat, Inc
7 * 8 *
8 * This code is partly based on hid-egalax.c: 9 * This code is partly based on hid-egalax.c:
9 * 10 *
@@ -26,13 +27,23 @@
26 * any later version. 27 * any later version.
27 */ 28 */
28 29
30/*
31 * This driver is regularly tested thanks to the tool hid-test[1].
32 * This tool relies on hid-replay[2] and a database of hid devices[3].
33 * Please run these regression tests before patching this module so that
34 * your patch won't break existing known devices.
35 *
36 * [1] https://github.com/bentiss/hid-test
37 * [2] https://github.com/bentiss/hid-replay
38 * [3] https://github.com/bentiss/hid-devices
39 */
40
29#include <linux/device.h> 41#include <linux/device.h>
30#include <linux/hid.h> 42#include <linux/hid.h>
31#include <linux/module.h> 43#include <linux/module.h>
32#include <linux/slab.h> 44#include <linux/slab.h>
33#include <linux/usb.h> 45#include <linux/usb.h>
34#include <linux/input/mt.h> 46#include <linux/input/mt.h>
35#include "usbhid/usbhid.h"
36 47
37 48
38MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>"); 49MODULE_AUTHOR("Stephane Chatty <chatty@enac.fr>");
@@ -723,7 +734,7 @@ static void mt_set_input_mode(struct hid_device *hdev)
723 r = re->report_id_hash[td->inputmode]; 734 r = re->report_id_hash[td->inputmode];
724 if (r) { 735 if (r) {
725 r->field[0]->value[td->inputmode_index] = 0x02; 736 r->field[0]->value[td->inputmode_index] = 0x02;
726 usbhid_submit_report(hdev, r, USB_DIR_OUT); 737 hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
727 } 738 }
728} 739}
729 740
@@ -748,7 +759,7 @@ static void mt_set_maxcontacts(struct hid_device *hdev)
748 max = min(fieldmax, max); 759 max = min(fieldmax, max);
749 if (r->field[0]->value[0] != max) { 760 if (r->field[0]->value[0] != max) {
750 r->field[0]->value[0] = max; 761 r->field[0]->value[0] = max;
751 usbhid_submit_report(hdev, r, USB_DIR_OUT); 762 hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
752 } 763 }
753 } 764 }
754} 765}
@@ -885,26 +896,11 @@ static int mt_reset_resume(struct hid_device *hdev)
885 896
886static int mt_resume(struct hid_device *hdev) 897static int mt_resume(struct hid_device *hdev)
887{ 898{
888 struct usb_interface *intf;
889 struct usb_host_interface *interface;
890 struct usb_device *dev;
891
892 if (hdev->bus != BUS_USB)
893 return 0;
894
895 intf = to_usb_interface(hdev->dev.parent);
896 interface = intf->cur_altsetting;
897 dev = hid_to_usb_dev(hdev);
898
899 /* Some Elan legacy devices require SET_IDLE to be set on resume. 899 /* Some Elan legacy devices require SET_IDLE to be set on resume.
900 * It should be safe to send it to other devices too. 900 * It should be safe to send it to other devices too.
901 * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */ 901 * Tested on 3M, Stantum, Cypress, Zytronic, eGalax, and Elan panels. */
902 902
903 usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 903 hid_hw_idle(hdev, 0, 0, HID_REQ_SET_IDLE);
904 HID_REQ_SET_IDLE,
905 USB_TYPE_CLASS | USB_RECIP_INTERFACE,
906 0, interface->desc.bInterfaceNumber,
907 NULL, 0, USB_CTRL_SET_TIMEOUT);
908 904
909 return 0; 905 return 0;
910} 906}