Browse Source

joystick: Improve GIP metadata retry

This reduces the number of retries, since they almost never help, and always
attempts the fallback if metadata fails enough times.
Vicki Pfau 3 months ago
parent
commit
7b3bd8c538
1 changed files with 3 additions and 6 deletions
  1. 3 6
      src/joystick/hidapi/SDL_hidapi_gip.c

+ 3 - 6
src/joystick/hidapi/SDL_hidapi_gip.c

@@ -1210,11 +1210,7 @@ static bool GIP_EnsureMetadata(GIP_Attachment *attachment)
     case GIP_METADATA_FAKED:
     case GIP_METADATA_FAKED:
         return true;
         return true;
     case GIP_METADATA_NONE:
     case GIP_METADATA_NONE:
-        if (attachment->quirks & GIP_QUIRK_BROKEN_METADATA) {
-            GIP_SendSystemMessage(attachment, GIP_CMD_METADATA, 0, NULL, 0);
-            GIP_SetMetadataDefaults(attachment);
-            return GIP_SendInitSequence(attachment);
-        } else if (attachment->device->got_hello) {
+        if (attachment->device->got_hello) {
             attachment->device->timeout = GIP_ACME_TIMEOUT;
             attachment->device->timeout = GIP_ACME_TIMEOUT;
             attachment->got_metadata = GIP_METADATA_PENDING;
             attachment->got_metadata = GIP_METADATA_PENDING;
             attachment->metadata_next = SDL_GetTicks() + 500;
             attachment->metadata_next = SDL_GetTicks() + 500;
@@ -2633,7 +2629,7 @@ static bool HIDAPI_DriverGIP_UpdateDevice(SDL_HIDAPI_Device *device)
             timestamp >= attachment->metadata_next &&
             timestamp >= attachment->metadata_next &&
             attachment->fragment_message != GIP_CMD_METADATA)
             attachment->fragment_message != GIP_CMD_METADATA)
         {
         {
-            if (attachment->metadata_retries < 5) {
+            if (attachment->metadata_retries < 3) {
                 SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "GIP: Retrying metadata request");
                 SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "GIP: Retrying metadata request");
                 attachment->metadata_retries++;
                 attachment->metadata_retries++;
                 attachment->metadata_next = timestamp + 500;
                 attachment->metadata_next = timestamp + 500;
@@ -2647,6 +2643,7 @@ static bool HIDAPI_DriverGIP_UpdateDevice(SDL_HIDAPI_Device *device)
                 GIP_SendSetDeviceState(attachment, GIP_STATE_RESET);
                 GIP_SendSetDeviceState(attachment, GIP_STATE_RESET);
             } else {
             } else {
                 GIP_SetMetadataDefaults(attachment);
                 GIP_SetMetadataDefaults(attachment);
+                GIP_SendInitSequence(attachment);
             }
             }
             perform_reset = false;
             perform_reset = false;
         }
         }