SDL_hid_get_input_report(3)
π SDL_hid_get_input_report β¨
okay bestie, so this one is a page from the SDL3 FUNCTIONS section of the manual, and it's all about the HID device life. SDL_hid_get_input_report β say it with me β it grabs an input report off a HID device. that's the whole vibe. π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_hidapi.h>
int SDL_hid_get_input_report(SDL_hid_device *dev, unsigned char *data, size_t length);
πΈ DESCRIPTION πΈ
ok so listen, this is the part where you have to be a little careful, no cap. π
Set the first byte of data to the Report ID of the report you wanna read. that's on you, bestie, the function will not do it for you. π
And make sure you leave space for that extra byte in data β it's giving "surprise, there's an extra byte" but it's not a surprise, i told you. π
Upon return, the first byte will still contain the Report ID, and the actual report data will start in data[1]. so like, the report ID is main character energy and it's not moving out of slot zero. π
π FUNCTION PARAMETERS π
devβ a device handle returned fromSDL_hid_open(). you know, the little ticket that says "yes, this is my device." ποΈdataβ a buffer to put the read data into, including the Report ID. Set the first byte ofdatato the Report ID of the report to be read, or set it to zero if your device does not use numbered reports. π«Άlengthβ the number of bytes to read, including an extra byte for the report ID. and the tea is: the buffer can be longer than the actual report. so don't stress if you over-allocated, it's fine, she's flexible. β¨
π₯ RETURN VALUE π₯
Returns the number of bytes read plus one for the report ID (which is still chilling in the first byte). π₯°
Or... -1 on on failure. π and if that happens, call SDL_GetError() for more info, because she will tell you what went wrong. (and yes, the original says "on on failure" β we do not gatekeep, we do not edit, periodt.) π
β AVAILABILITY β
This function is available since SDL 3.2.0. so if you're on something older, bestie, you're simply not invited to this party. π
and that's the whole page, you ate it up, no crumbs. π this lil beauty comes to you from Simple Directmedia Layer, version SDL 3.4.18, and it's filed under SDL_hid_get_input_report(3). mwah, go read the 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