mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-13 15:23:34 +00:00
switch2: Move initialization after reading calibration
This removes the need to wait for initialization to finish
This commit is contained in:
@@ -376,17 +376,6 @@ static bool HIDAPI_DriverSwitch2_InitUSB(SDL_HIDAPI_Device *device)
|
||||
};
|
||||
unsigned char calibration_data[0x50] = {0};
|
||||
|
||||
for (int i = 0; init_sequence[i].size; i++) {
|
||||
res = SendBulkData(ctx, init_sequence[i].data, init_sequence[i].size);
|
||||
if (res < 0) {
|
||||
return SDL_SetError("Couldn't send initialization data: %d\n", res);
|
||||
}
|
||||
RecvBulkData(ctx, calibration_data, 0x40);
|
||||
}
|
||||
|
||||
// Wait for initialization to complete
|
||||
SDL_Delay(1);
|
||||
|
||||
flash_read_command[12] = 0x80;
|
||||
res = SendBulkData(ctx, flash_read_command, sizeof(flash_read_command));
|
||||
if (res < 0) {
|
||||
@@ -458,6 +447,14 @@ static bool HIDAPI_DriverSwitch2_InitUSB(SDL_HIDAPI_Device *device)
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; init_sequence[i].size; i++) {
|
||||
res = SendBulkData(ctx, init_sequence[i].data, init_sequence[i].size);
|
||||
if (res < 0) {
|
||||
return SDL_SetError("Couldn't send initialization data: %d\n", res);
|
||||
}
|
||||
RecvBulkData(ctx, calibration_data, 0x40);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user