Skip to content

Commit

Permalink
Log gamepad added/removed
Browse files Browse the repository at this point in the history
Add a log when a gamepad is added or removed.
  • Loading branch information
rom1v committed Dec 8, 2024
1 parent 7418fd0 commit 548d2c7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/uhid/gamepad_uhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ sc_gamepad_processor_process_gamepad_added(struct sc_gamepad_processor *gp,
return;
}

SDL_GameController* game_controller =
SDL_GameControllerFromInstanceID(event->gamepad_id);
assert(game_controller);
const char *name = SDL_GameControllerName(game_controller);
LOGI("Gamepad added: [%" PRIu32 "] %s", event->gamepad_id, name);

sc_gamepad_uhid_send_open(gamepad, &hid_open);
}

Expand All @@ -83,6 +89,8 @@ sc_gamepad_processor_process_gamepad_removed(struct sc_gamepad_processor *gp,
return;
}

LOGI("Gamepad removed: [%" PRIu32 "]", event->gamepad_id);

sc_gamepad_uhid_send_close(gamepad, &hid_close);
}

Expand Down

0 comments on commit 548d2c7

Please sign in to comment.