SDL_hid_enumerate(3)
π SDL_hid_enumerate(3) π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the internet, where today's main character is SDL_hid_enumerate β the girl who goes out and finds every HID device for you. no cap. π
β¨ NAME β¨
SDL_hid_enumerate β Enumerate the HID Devices. that's it, that's the job. she makes a list and she checks it twice. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_hidapi.h>
SDL_hid_device_info * SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
πΈ DESCRIPTION πΈ
so here's the vibe: this function hands you back a linked list of every HID device chilling on the system that matches vendor_id and product_id. it's giving roll call. π
- set
vendor_idto0and literally any vendor matches β she's not picky, she's generous. - set
product_idto0and any product matches, same energy. - set both
vendor_idandproduct_idto0and you get ALL the HID devices. the whole party. every single one. π
β¨ heads up bestie: by default SDL will only enumerate controllers. and honestly? that's on purpose β it keeps you from hanging or crashing on bad drivers. but if you're feeling brave,SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERScan be set to"0"to enumerate all HID devices. you do you. π
π FUNCTION PARAMETERS π
vendor_idβ the Vendor ID (VID) of the types of device to open, or0to match any vendor. πproduct_idβ the Product ID (PID) of the types of device to open, or0to match any product. π«Ά
β RETURN VALUE β
she returns a pointer to a linked list of type SDL_hid_device_info β all the tea about the HID devices attached to the system. β
or NULL in the case of failure. π (not the slay we wanted.)
π¨ and listen: you must free this linked list by calling SDL_hid_free_enumeration(). don't just leave her hanging, that's a memory leak and it's not cute. π
π AVAILABILITY π
this function is available since SDL 3.2.0. so if you're on an older SDL, she does not exist yet. sorry bestie. π
π SEE ALSO π
SDL_hid_device_change_count(3)β go read her too, iykyk. π§
and that's the whole page, babe. every flag, every default, every warning, all of it. ate and left no crumbs. π β¨
β with love from the <b>Simple Directmedia Layer</b> girlies, <b>SDL 3.4.18</b>, dated <b>SDL_hid_enumerate(3)</b> ππ¦πΈ
π¦ 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