]> Git Repo - linux.git/commitdiff
Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-3.15/sony
authorJiri Kosina <[email protected]>
Tue, 1 Apr 2014 16:45:27 +0000 (18:45 +0200)
committerJiri Kosina <[email protected]>
Tue, 1 Apr 2014 16:45:27 +0000 (18:45 +0200)
1  2 
drivers/hid/hid-sony.c

diff --combined drivers/hid/hid-sony.c
index c364be158ae6d3d811e72c441f374835501f8aca,4884bb567bf88ab0a71030c6eb9666c4fc88cbab..908de278921944dfae837284f582e117617c479d
@@@ -29,7 -29,6 +29,6 @@@
  #include <linux/hid.h>
  #include <linux/module.h>
  #include <linux/slab.h>
- #include <linux/usb.h>
  #include <linux/leds.h>
  #include <linux/power_supply.h>
  #include <linux/spinlock.h>
@@@ -864,7 -863,7 +863,7 @@@ static void sixaxis_parse_report(struc
                battery_capacity = sixaxis_battery_capacity[index];
                battery_charging = 0;
        }
 -      cable_state = !((rd[31] >> 4) & 0x01);
 +      cable_state = !(rd[31] & 0x04);
  
        spin_lock_irqsave(&sc->lock, flags);
        sc->cable_state = cable_state;
@@@ -1006,45 -1005,6 +1005,6 @@@ static int sony_mapping(struct hid_devi
        return 0;
  }
  
- /*
-  * The Sony Sixaxis does not handle HID Output Reports on the Interrupt EP
-  * like it should according to usbhid/hid-core.c::usbhid_output_raw_report()
-  * so we need to override that forcing HID Output Reports on the Control EP.
-  *
-  * There is also another issue about HID Output Reports via USB, the Sixaxis
-  * does not want the report_id as part of the data packet, so we have to
-  * discard buf[0] when sending the actual control message, even for numbered
-  * reports, humpf!
-  */
- static int sixaxis_usb_output_raw_report(struct hid_device *hid, __u8 *buf,
-               size_t count, unsigned char report_type)
- {
-       struct usb_interface *intf = to_usb_interface(hid->dev.parent);
-       struct usb_device *dev = interface_to_usbdev(intf);
-       struct usb_host_interface *interface = intf->cur_altsetting;
-       int report_id = buf[0];
-       int ret;
-       if (report_type == HID_OUTPUT_REPORT) {
-               /* Don't send the Report ID */
-               buf++;
-               count--;
-       }
-       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-               HID_REQ_SET_REPORT,
-               USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-               ((report_type + 1) << 8) | report_id,
-               interface->desc.bInterfaceNumber, buf, count,
-               USB_CTRL_SET_TIMEOUT);
-       /* Count also the Report ID, in case of an Output report. */
-       if (ret > 0 && report_type == HID_OUTPUT_REPORT)
-               ret++;
-       return ret;
- }
  /*
   * Sending HID_REQ_GET_REPORT changes the operation mode of the ps3 controller
   * to "operational".  Without this, the ps3 controller will not report any
@@@ -1072,8 -1032,8 +1032,8 @@@ static int sixaxis_set_operational_usb(
  static int sixaxis_set_operational_bt(struct hid_device *hdev)
  {
        unsigned char buf[] = { 0xf4,  0x42, 0x03, 0x00, 0x00 };
-       return hid_output_raw_report(hdev, buf, sizeof(buf),
-                                    HID_FEATURE_REPORT);
+       return hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf),
+                                 HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
  }
  
  /*
@@@ -1305,11 -1265,8 +1265,8 @@@ static void sixaxis_state_worker(struc
        buf[10] |= sc->led_state[2] << 3;
        buf[10] |= sc->led_state[3] << 4;
  
-       if (sc->quirks & SIXAXIS_CONTROLLER_USB)
-               hid_output_raw_report(sc->hdev, buf, sizeof(buf), HID_OUTPUT_REPORT);
-       else
-               hid_hw_raw_request(sc->hdev, 0x01, buf, sizeof(buf),
-                               HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
+       hid_hw_raw_request(sc->hdev, 0x01, buf, sizeof(buf), HID_OUTPUT_REPORT,
+                       HID_REQ_SET_REPORT);
  }
  
  static void dualshock4_state_worker(struct work_struct *work)
@@@ -1659,26 -1616,27 +1616,37 @@@ static int sony_probe(struct hid_devic
        }
  
        if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
-               hdev->hid_output_raw_report = sixaxis_usb_output_raw_report;
+               /*
+                * The Sony Sixaxis does not handle HID Output Reports on the
+                * Interrupt EP like it could, so we need to force HID Output
+                * Reports to use HID_REQ_SET_REPORT on the Control EP.
+                *
+                * There is also another issue about HID Output Reports via USB,
+                * the Sixaxis does not want the report_id as part of the data
+                * packet, so we have to discard buf[0] when sending the actual
+                * control message, even for numbered reports, humpf!
+                */
+               hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
+               hdev->quirks |= HID_QUIRK_SKIP_OUTPUT_REPORT_ID;
                ret = sixaxis_set_operational_usb(hdev);
                sc->worker_initialized = 1;
                INIT_WORK(&sc->state_worker, sixaxis_state_worker);
        } else if (sc->quirks & SIXAXIS_CONTROLLER_BT) {
 +              /*
 +               * The Sixaxis wants output reports sent on the ctrl endpoint
 +               * when connected via Bluetooth.
 +               */
 +              hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
                ret = sixaxis_set_operational_bt(hdev);
                sc->worker_initialized = 1;
                INIT_WORK(&sc->state_worker, sixaxis_state_worker);
        } else if (sc->quirks & DUALSHOCK4_CONTROLLER) {
                if (sc->quirks & DUALSHOCK4_CONTROLLER_BT) {
 +                      /*
 +                       * The DualShock 4 wants output reports sent on the ctrl
 +                       * endpoint when connected via Bluetooth.
 +                       */
 +                      hdev->quirks |= HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP;
                        ret = dualshock4_set_operational_bt(hdev);
                        if (ret < 0) {
                                hid_err(hdev, "failed to set the Dualshock 4 operational mode\n");
This page took 0.062604 seconds and 4 git commands to generate.