aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2013-02-25 05:31:43 -0500
committerJiri Kosina <jkosina@suse.cz>2013-02-25 07:26:39 -0500
commite90a6df80dc45ab53d2f4f4db297434e48c0208e (patch)
treec2758516b5a1d387ac81017de45adde6f19f622a /drivers/hid
parent48a732dfaa77a4dfec803aa8f248373998704f76 (diff)
HID: Extend the interface with report requests
Some drivers send reports directly to underlying device, creating an unwanted dependency on the underlying transport layer. This patch adds hid_hw_request() to the interface, thereby removing usbhid from the lion share of the drivers. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/usbhid/hid-core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 8e0c4bf94ebc..366fd09d257d 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1243,6 +1243,18 @@ static int usbhid_power(struct hid_device *hid, int lvl)
1243 return r; 1243 return r;
1244} 1244}
1245 1245
1246static void usbhid_request(struct hid_device *hid, struct hid_report *rep, int reqtype)
1247{
1248 switch (reqtype) {
1249 case HID_REQ_GET_REPORT:
1250 usbhid_submit_report(hid, rep, USB_DIR_IN);
1251 break;
1252 case HID_REQ_SET_REPORT:
1253 usbhid_submit_report(hid, rep, USB_DIR_OUT);
1254 break;
1255 }
1256}
1257
1246static struct hid_ll_driver usb_hid_driver = { 1258static struct hid_ll_driver usb_hid_driver = {
1247 .parse = usbhid_parse, 1259 .parse = usbhid_parse,
1248 .start = usbhid_start, 1260 .start = usbhid_start,
@@ -1251,6 +1263,7 @@ static struct hid_ll_driver usb_hid_driver = {
1251 .close = usbhid_close, 1263 .close = usbhid_close,
1252 .power = usbhid_power, 1264 .power = usbhid_power,
1253 .hidinput_input_event = usb_hidinput_input_event, 1265 .hidinput_input_event = usb_hidinput_input_event,
1266 .request = usbhid_request,
1254}; 1267};
1255 1268
1256static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id) 1269static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)