Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux-2.6-microblaze.git] / drivers / hid / hid-sony.c
index ed2f008..661f94f 100644 (file)
@@ -296,7 +296,14 @@ static __u8 navigation_rdesc[] = {
        0x09, 0x01,         /*          Usage (Pointer),            */
        0x81, 0x02,         /*          Input (Variable),           */
        0x06, 0x00, 0xFF,   /*          Usage Page (FF00h),         */
-       0x95, 0x20,         /*          Report Count (26),          */
+       0x95, 0x01,         /*          Report Count (1),           */
+       0x81, 0x02,         /*          Input (Variable),           */
+       0x05, 0x01,         /*          Usage Page (Desktop),       */
+       0x95, 0x01,         /*          Report Count (1),           */
+       0x09, 0x01,         /*          Usage (Pointer),            */
+       0x81, 0x02,         /*          Input (Variable),           */
+       0x06, 0x00, 0xFF,   /*          Usage Page (FF00h),         */
+       0x95, 0x1E,         /*          Report Count (24),          */
        0x81, 0x02,         /*          Input (Variable),           */
        0x75, 0x08,         /*          Report Size (8),            */
        0x95, 0x30,         /*          Report Count (48),          */
@@ -1270,6 +1277,17 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
         * has to be BYTE_SWAPPED before passing up to joystick interface
         */
        if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) {
+               /*
+                * When connected via Bluetooth the Sixaxis occasionally sends
+                * a report with the second byte 0xff and the rest zeroed.
+                *
+                * This report does not reflect the actual state of the
+                * controller must be ignored to avoid generating false input
+                * events.
+                */
+               if (rd[1] == 0xff)
+                       return -EINVAL;
+
                swap(rd[41], rd[42]);
                swap(rd[43], rd[44]);
                swap(rd[45], rd[46]);
@@ -1836,7 +1854,7 @@ static void dualshock4_state_worker(struct work_struct *work)
        } else {
                memset(buf, 0, DS4_REPORT_0x11_SIZE);
                buf[0] = 0x11;
-               buf[1] = 0xB0;
+               buf[1] = 0x80;
                buf[3] = 0x0F;
                offset = 6;
        }