Skip to content

Commit 7b3bd8c

Browse files
endriftslouken
authored andcommitted
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.
1 parent 367cf9b commit 7b3bd8c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/joystick/hidapi/SDL_hidapi_gip.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,11 +1210,7 @@ static bool GIP_EnsureMetadata(GIP_Attachment *attachment)
12101210
case GIP_METADATA_FAKED:
12111211
return true;
12121212
case GIP_METADATA_NONE:
1213-
if (attachment->quirks & GIP_QUIRK_BROKEN_METADATA) {
1214-
GIP_SendSystemMessage(attachment, GIP_CMD_METADATA, 0, NULL, 0);
1215-
GIP_SetMetadataDefaults(attachment);
1216-
return GIP_SendInitSequence(attachment);
1217-
} else if (attachment->device->got_hello) {
1213+
if (attachment->device->got_hello) {
12181214
attachment->device->timeout = GIP_ACME_TIMEOUT;
12191215
attachment->got_metadata = GIP_METADATA_PENDING;
12201216
attachment->metadata_next = SDL_GetTicks() + 500;
@@ -2633,7 +2629,7 @@ static bool HIDAPI_DriverGIP_UpdateDevice(SDL_HIDAPI_Device *device)
26332629
timestamp >= attachment->metadata_next &&
26342630
attachment->fragment_message != GIP_CMD_METADATA)
26352631
{
2636-
if (attachment->metadata_retries < 5) {
2632+
if (attachment->metadata_retries < 3) {
26372633
SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "GIP: Retrying metadata request");
26382634
attachment->metadata_retries++;
26392635
attachment->metadata_next = timestamp + 500;
@@ -2647,6 +2643,7 @@ static bool HIDAPI_DriverGIP_UpdateDevice(SDL_HIDAPI_Device *device)
26472643
GIP_SendSetDeviceState(attachment, GIP_STATE_RESET);
26482644
} else {
26492645
GIP_SetMetadataDefaults(attachment);
2646+
GIP_SendInitSequence(attachment);
26502647
}
26512648
perform_reset = false;
26522649
}

0 commit comments

Comments
 (0)