MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / WriteSubcommand

Function WriteSubcommand

deps/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c:369–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

367}
368
369static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs ucCommandID, Uint8 *pBuf, Uint8 ucLen, SwitchSubcommandInputPacket_t **ppReply)
370{
371 int nRetries = 5;
372 SwitchSubcommandInputPacket_t *reply = NULL;
373
374 while (!reply && nRetries--) {
375 SwitchSubcommandOutputPacket_t commandPacket;
376 ConstructSubcommand(ctx, ucCommandID, pBuf, ucLen, &commandPacket);
377
378 if (!WritePacket(ctx, &commandPacket, sizeof(commandPacket))) {
379 continue;
380 }
381
382 reply = ReadSubcommandReply(ctx, ucCommandID);
383 }
384
385 if (ppReply) {
386 *ppReply = reply;
387 }
388 return reply != NULL;
389}
390
391static SDL_bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCommandIDs ucCommand, Uint8 *pBuf, Uint8 ucLen, SDL_bool waitForReply)
392{

Callers 5

SetVibrationEnabledFunction · 0.85
SetInputModeFunction · 0.85
SetHomeLEDFunction · 0.85
SetSlotLEDFunction · 0.85
LoadStickCalibrationFunction · 0.85

Calls 3

ConstructSubcommandFunction · 0.85
WritePacketFunction · 0.85
ReadSubcommandReplyFunction · 0.85

Tested by

no test coverage detected