SDL_hid_get_feature_report(3)
π SDL_hid_get_feature_report π
okay bestie, welcome to the SDL_hid_get_feature_report(3) page, straight out of the SDL3 FUNCTIONS section of the manual, no cap. this one's all about pulling a feature report out of a HID device. let's get into it π¦
β¨ NAME β¨
SDL_hid_get_feature_report β grab a feature report from a HID device, periodt.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_hidapi.h>
int SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
π DESCRIPTION π
okay so here's the tea π β you set the first byte of data to the Report ID of the report you wanna read. and listen, make sure you actually leave space for that extra byte in data, because it's coming along for the ride.
when the call comes back, that first byte is still holding the Report ID (she's not going anywhere πβοΈ), and the actual report data starts over at data[1]. iconic behavior honestly.
π FUNCTION PARAMETERS π
devβ a device handle that came fromSDL_hid_open(). your little key to the device, basically πdataβ the buffer where the read data goes, Report ID included. set the first byte ofdatato the Report ID of the report you're reading, or set it to zero if your device doesn't do numbered reports. either way, she's in there.lengthβ how many bytes to read, counting that extra byte for the report ID. lowkey the buffer can be bigger than the actual report, so no stress about it being exactly sized π«Ά
β RETURN VALUE β
returns the number of bytes read plus one for the report ID (which is still chillin' in the first byte), or -1 on failure π. if it fails, hit up SDL_GetError() for more info.
π AVAILABILITY π
this function has been available since SDL 3.2.0. she's new-ish but she's thriving π
and that's the whole page, bestie β go read some reports π
shoutout to the Simple Directmedia Layer for making this happen, version SDL 3.4.18, SDL_hid_get_feature_report(3). mwah, bye π§π
π¦ 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