Added the full Xbox One Elite Series 2 controller initialization sequence, to start input reports after switching out of Bluetooth mode.
authorSam Lantinga <slouken@libsdl.org>
Wed, 27 Nov 2019 18:26:57 -0800
changeset 13300b533e3aa4ac0
parent 13299 d642e14375b6
child 13301 1953486198ee
Added the full Xbox One Elite Series 2 controller initialization sequence, to start input reports after switching out of Bluetooth mode.
src/joystick/hidapi/SDL_hidapi_xboxone.c
     1.1 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c	Wed Nov 27 17:17:03 2019 -0800
     1.2 +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c	Wed Nov 27 18:26:57 2019 -0800
     1.3 @@ -39,6 +39,32 @@
     1.4  /* The amount of time to wait after hotplug to send controller init sequence */
     1.5  #define CONTROLLER_INIT_DELAY_MS    100
     1.6  
     1.7 +/* This is the full init sequence for the Xbox One Elite Series 2 controller.
     1.8 +   Normally it isn't needed, but this switches the controller back to wired report mode after being in Bluetooth mode.
     1.9 +*/
    1.10 +static const Uint8 xboxone_elite_init0[] = {
    1.11 +    0x04, 0x20, 0x01, 0x00
    1.12 +};
    1.13 +static const Uint8 xboxone_elite_init1[] = {
    1.14 +    0x01, 0x20, 0x28, 0x09, 0x00, 0x04, 0x20, 0x3A,
    1.15 +    0x00, 0x00, 0x00, 0x31, 0x01
    1.16 +};
    1.17 +static const Uint8 xboxone_elite_init2[] = {
    1.18 +    0x01, 0x20, 0x28, 0x09, 0x00, 0x04, 0x20, 0x6B,
    1.19 +    0x01, 0x00, 0x00, 0x00, 0x00
    1.20 +};
    1.21 +static const Uint8 xboxone_elite_init3[] = {
    1.22 +    0x05, 0x20, 0x02, 0x0F, 0x06, 0x00, 0x00, 0x00,
    1.23 +    0x00, 0x00, 0x00, 0x55, 0x53, 0x00, 0x00, 0x00,
    1.24 +    0x00, 0x00, 0x00
    1.25 +};
    1.26 +static const Uint8 xboxone_elite_init4[] = {
    1.27 +    0x05, 0x20, 0x03, 0x01, 0x00
    1.28 +};
    1.29 +static const Uint8 xboxone_elite_init5[] = {
    1.30 +    0x0A, 0x20, 0x04, 0x03, 0x00, 0x01, 0x14
    1.31 +};
    1.32 +
    1.33  /*
    1.34   * This packet is required for all Xbox One pads with 2015
    1.35   * or later firmware installed (or present from the factory).
    1.36 @@ -108,9 +134,16 @@
    1.37      int size;
    1.38  } SDL_DriverXboxOne_InitPacket;
    1.39  
    1.40 +
    1.41  static const SDL_DriverXboxOne_InitPacket xboxone_init_packets[] = {
    1.42      { 0x0e6f, 0x0165, xboxone_hori_init, sizeof(xboxone_hori_init) },
    1.43      { 0x0f0d, 0x0067, xboxone_hori_init, sizeof(xboxone_hori_init) },
    1.44 +    { 0x045e, 0x0b00, xboxone_elite_init0, sizeof(xboxone_elite_init0) },
    1.45 +    { 0x045e, 0x0b00, xboxone_elite_init1, sizeof(xboxone_elite_init1) },
    1.46 +    { 0x045e, 0x0b00, xboxone_elite_init2, sizeof(xboxone_elite_init2) },
    1.47 +    { 0x045e, 0x0b00, xboxone_elite_init3, sizeof(xboxone_elite_init3) },
    1.48 +    { 0x045e, 0x0b00, xboxone_elite_init4, sizeof(xboxone_elite_init4) },
    1.49 +    { 0x045e, 0x0b00, xboxone_elite_init5, sizeof(xboxone_elite_init5) },
    1.50      { 0x0000, 0x0000, xboxone_fw2015_init, sizeof(xboxone_fw2015_init) },
    1.51      { 0x0e6f, 0x0000, xboxone_pdp_init1, sizeof(xboxone_pdp_init1) },
    1.52      { 0x0e6f, 0x0000, xboxone_pdp_init2, sizeof(xboxone_pdp_init2) },