aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-04-01 13:05:09 -0400
committerJiri Kosina <jkosina@suse.cz>2014-04-01 13:05:09 -0400
commitad295b6d5739ab24880a31be403bbc8fab62e177 (patch)
treecd760a18bcfa6e59b8b63fc71e333ba394b1cd9c /drivers/hid/usbhid
parentba04a57b4acd05a764471b2accd02000f6641881 (diff)
parentc3d77fab51f40821de91a744e4b514e9e4e76a7c (diff)
Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-linus
Conflicts: drivers/hid/hid-ids.h drivers/hid/hid-sony.c drivers/hid/i2c-hid/i2c-hid.c
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r--drivers/hid/usbhid/hid-core.c64
1 files changed, 7 insertions, 57 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index f8ca312bae1b..7b88f4cb9902 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -894,7 +894,12 @@ static int usbhid_set_raw_report(struct hid_device *hid, unsigned int reportnum,
894 int ret, skipped_report_id = 0; 894 int ret, skipped_report_id = 0;
895 895
896 /* Byte 0 is the report number. Report data starts at byte 1.*/ 896 /* Byte 0 is the report number. Report data starts at byte 1.*/
897 buf[0] = reportnum; 897 if ((rtype == HID_OUTPUT_REPORT) &&
898 (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORT_ID))
899 buf[0] = 0;
900 else
901 buf[0] = reportnum;
902
898 if (buf[0] == 0x0) { 903 if (buf[0] == 0x0) {
899 /* Don't send the Report ID */ 904 /* Don't send the Report ID */
900 buf++; 905 buf++;
@@ -915,59 +920,6 @@ static int usbhid_set_raw_report(struct hid_device *hid, unsigned int reportnum,
915 return ret; 920 return ret;
916} 921}
917 922
918
919static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t count,
920 unsigned char report_type)
921{
922 struct usbhid_device *usbhid = hid->driver_data;
923 struct usb_device *dev = hid_to_usb_dev(hid);
924 struct usb_interface *intf = usbhid->intf;
925 struct usb_host_interface *interface = intf->cur_altsetting;
926 int ret;
927
928 if (usbhid->urbout && report_type != HID_FEATURE_REPORT) {
929 int actual_length;
930 int skipped_report_id = 0;
931
932 if (buf[0] == 0x0) {
933 /* Don't send the Report ID */
934 buf++;
935 count--;
936 skipped_report_id = 1;
937 }
938 ret = usb_interrupt_msg(dev, usbhid->urbout->pipe,
939 buf, count, &actual_length,
940 USB_CTRL_SET_TIMEOUT);
941 /* return the number of bytes transferred */
942 if (ret == 0) {
943 ret = actual_length;
944 /* count also the report id */
945 if (skipped_report_id)
946 ret++;
947 }
948 } else {
949 int skipped_report_id = 0;
950 int report_id = buf[0];
951 if (buf[0] == 0x0) {
952 /* Don't send the Report ID */
953 buf++;
954 count--;
955 skipped_report_id = 1;
956 }
957 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
958 HID_REQ_SET_REPORT,
959 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
960 ((report_type + 1) << 8) | report_id,
961 interface->desc.bInterfaceNumber, buf, count,
962 USB_CTRL_SET_TIMEOUT);
963 /* count also the report id, if this was a numbered report. */
964 if (ret > 0 && skipped_report_id)
965 ret++;
966 }
967
968 return ret;
969}
970
971static int usbhid_output_report(struct hid_device *hid, __u8 *buf, size_t count) 923static int usbhid_output_report(struct hid_device *hid, __u8 *buf, size_t count)
972{ 924{
973 struct usbhid_device *usbhid = hid->driver_data; 925 struct usbhid_device *usbhid = hid->driver_data;
@@ -975,7 +927,7 @@ static int usbhid_output_report(struct hid_device *hid, __u8 *buf, size_t count)
975 int actual_length, skipped_report_id = 0, ret; 927 int actual_length, skipped_report_id = 0, ret;
976 928
977 if (!usbhid->urbout) 929 if (!usbhid->urbout)
978 return -EIO; 930 return -ENOSYS;
979 931
980 if (buf[0] == 0x0) { 932 if (buf[0] == 0x0) {
981 /* Don't send the Report ID */ 933 /* Don't send the Report ID */
@@ -1331,8 +1283,6 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
1331 1283
1332 usb_set_intfdata(intf, hid); 1284 usb_set_intfdata(intf, hid);
1333 hid->ll_driver = &usb_hid_driver; 1285 hid->ll_driver = &usb_hid_driver;
1334 hid->hid_get_raw_report = usbhid_get_raw_report;
1335 hid->hid_output_raw_report = usbhid_output_raw_report;
1336 hid->ff_init = hid_pidff_init; 1286 hid->ff_init = hid_pidff_init;
1337#ifdef CONFIG_USB_HIDDEV 1287#ifdef CONFIG_USB_HIDDEV
1338 hid->hiddev_connect = hiddev_connect; 1288 hid->hiddev_connect = hiddev_connect;