SDL_hid_send_feature_report(3)
β¨ SDL_hid_send_feature_report β¨
okay bestie, welcome to the SDL_hid_send_feature_report(3) page, straight out of the SDL3 FUNCTIONS lineup π this is where you yeet a Feature report at your device, and honestly? it's giving main character energy.
πΈ NAME πΈ
SDL_hid_send_feature_report β send a Feature report to the device π
π SYNOPSIS π
#include <SDL3/SDL_hidapi.h>
int SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
π¦ DESCRIPTION π¦
so here's the tea π Feature reports go out over the Control endpoint as a Set_Report transfer. that's just how it is, periodt.
the first byte of data must hold the Report ID β no skipping, no negotiating. for devices that only support a single report, that byte has to be set to 0x0. everything after that first byte is the actual report data.
and here's the part that trips people up: because the Report ID is mandatory, every single call to SDL_hid_send_feature_report() will contain one more byte than the report itself contains. one. extra. byte. always. π
example time, because numbers make it click: if a hid report is 16 bytes long, you have to pass 17 bytes to SDL_hid_send_feature_report() β that's the Report ID (or 0x0, for devices which do not use numbered reports) followed by the report data (the 16 bytes). so in that example, the length you pass in would be 17. slay π
π FUNCTION PARAMETERS π
devβ a device handle returned fromSDL_hid_open(). your ticket to the device, basically ποΈdataβ the data to send, including the report number as the first byte. don't forget that first byte, bestie, I'm begging πlengthβ the length in bytes of the data to send, including the report number. yes, counting that extra byte. yes, it's on purpose π
β RETURN VALUE β
it returns the actual number of bytes written π«Ά and -1 on failure β in which case you should call SDL_GetError() for more info. go get that lore, you deserve to know what went wrong π
π AVAILABILITY π
this function is available since SDL 3.2.0 β¨ iconic behaviour, no cap.
Simple Directmedia Layer wrote this one, and this page is living in SDL 3.4.18 β mwah, thanks for reading, drink some water, and go send that feature report πππ¦
π¦ 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