src/joystick/hidapi/SDL_hidapi_xboxone.c
changeset 13324 b46a94bb2ab0
parent 13323 a8804daa1c3d
child 13330 c88765bcf1da
     1.1 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c	Mon Dec 09 13:54:05 2019 -0800
     1.2 +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c	Mon Dec 09 16:52:11 2019 -0800
     1.3 @@ -192,7 +192,7 @@
     1.4      Uint16 product_id = ctx->product_id;
     1.5  
     1.6      if (!IsBluetoothXboxOneController(vendor_id, product_id)) {
     1.7 -        int i;
     1.8 +        int i, j;
     1.9          Uint8 init_packet[USB_PACKET_LENGTH];
    1.10  
    1.11          for (i = 0; i < SDL_arraysize(xboxone_init_packets); ++i) {
    1.12 @@ -212,6 +212,16 @@
    1.13                  SDL_SetError("Couldn't write Xbox One initialization packet");
    1.14                  return SDL_FALSE;
    1.15              }
    1.16 +
    1.17 +            /* After the init we need to sync up the rumble sequence */
    1.18 +            if (packet->data == xboxone_fw2015_init) {
    1.19 +                for (j = 0; j < 255; ++j) {
    1.20 +                    if (hid_write(dev, xboxone_rumbleend_init, sizeof(xboxone_rumbleend_init)) != sizeof(xboxone_rumbleend_init)) {
    1.21 +                        SDL_SetError("Couldn't write Xbox One initialization packet");
    1.22 +                        return SDL_FALSE;
    1.23 +                    }
    1.24 +                }
    1.25 +            }
    1.26          }
    1.27      }
    1.28      return SDL_TRUE;
    1.29 @@ -227,7 +237,7 @@
    1.30          return SDL_FALSE;
    1.31      }
    1.32      if (vendor_id == 0x24c6 && product_id == 0x541a) {
    1.33 -        /* The PowerA Mini controller blocks while writing feature reports */
    1.34 +        /* The PowerA Mini controller, model 1240245-01, blocks while writing feature reports */
    1.35          return SDL_FALSE;
    1.36      }
    1.37  #endif