SDL_hid_init(3)
β¨ SDL_hid_init β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_hid_init(3) and honestly? she's a little queen. π
πΈ NAME πΈ
SDL_hid_init β initialize the HIDAPI library. that's it. that's the job. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_hidapi.h>
int SDL_hid_init(void);
no arguments, no drama, just vibes. β¨
π DESCRIPTION π
so this function initializes the HIDAPI library. that's the whole thing. π«Ά
but here's the tea: calling it is not strictly necessary, because it's gonna get called automatically by SDL_hid_enumerate() and by any of the SDL_hid_open_*() functions if it turns out they need it. so she's like, self-sufficient. independent. main character energy. π
however β and this is the part you actually need to remember β you should still call this function at the beginning of execution if there's a chance that HIDAPI handles could get opened by different threads simultaneously. like, if your threads are all reaching for handles at the same time with no adult supervision? yeah, call it up front. no cap. π
β οΈ also every single call to this function needs a matching call to SDL_hid_exit(). they're a package deal, fr fr. don't leave her hanging. π
π RETURN VALUE π
- returns
0on success β¨ - returns a negative error code on failure π β and in that case you should call
SDL_GetError()for more info, she'll tell you what went wrong. π
β AVAILABILITY β
this function has been available since SDL 3.2.0. she's been here. she's established. respect it. π
π SEE ALSO π
SDL_hid_exit(3)β the other half of the duo, go read her too π§
Simple Directmedia Layer made this one, it's from SDL 3.4.18, and that's the whole SDL_hid_init(3) page β slay, stay hydrated, and don't forget your matching SDL_hid_exit() bestie πβ¨πΈπ¦π
π¦ 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