SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS(3)
โจ SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS โจ
okay bestie gather round, because this one is a hint in the SDL3 family, living its best life in the SDL3 functions manual, and its whole personality is deciding whether SDL_hid_enumerate() goes snooping through every HID device on the system or just chills with the controllers. ๐ฎ๐
๐ธ SYNOPSIS ๐ธ
#include <SDL3/SDL_hints.h>
#define SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS "SDL_HIDAPI_ENUMERATE_ONLY_CONTROLLERS"
like yes, it's a #define, it's a string, it's literally that exact string, no notes. ๐ซถ
๐ DESCRIPTION ๐
so the way this works is you set the variable to one of these two values and SDL does the thing:
"0"โSDL_hid_enumerate()will enumerate all HID devices. all of them. the whole roster. ๐"1"โSDL_hid_enumerate()will only enumerate controllers. (default) ๐
and here's the tea on why "1" is the default, because it's not just a vibe, it's self-preservation: by default SDL will only enumerate controllers, to reduce risk of hanging or crashing on devices with bad drivers, and to avoid macOS keyboard capture permission prompts. so yeah, defaulting to controllers-only is lowkey a safety feature and highkey a "please don't let a cursed driver take down the whole app" feature. ๐ญ
not me being dramatic, but the bad-driver hang/crash risk is real and the macOS permission prompts are real, so if you flip this to "0" you're doing it on purpose, periodt.
also good news: this hint can be set anytime. โฐโจ no weird timing rules, no "only before init" nonsense, set it whenever your heart desires.
๐ฆ AVAILABILITY ๐ฆ
this hint has been available since SDL 3.2.0. so if you're on anything older, bestie, it's not there yet โ go update. ๐ง
๐ a lil sign-off ๐
that's the whole page, mwah ๐ โ brought to you by Simple Directmedia Layer, running on SDL 3.4.18, and you can find it hanging out in the SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS(3) section of your friendly neighbourhood manual. go forth and enumerate responsibly. ๐๐ธ
๐ฆ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms