SDL_hid_device_info(3type)

πŸ’– SDL_hid_device_info β€” the tea on your HID devices

okay so bestie, welcome to SDL3 DATATYPES, and today's main character is SDL_hid_device_info πŸŽ€ β€” it's the lil struct that spills everything about a connected HID device. yes, the whole vibe. every field. let's get into it ✨


✨ NAME ✨

SDL_hid_device_info β€” literally just Information about a connected HID device πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_hidapi.h>

typedef struct SDL_hid_device_info
{
    /** Platform-specific device path */
    char *path;
    /** Device Vendor ID */
    unsigned short vendor_id;
    /** Device Product ID */
    unsigned short product_id;
    /** Serial Number */
    wchar_t *serial_number;
    /** Device Release Number in binary-coded decimal,
        also known as Device Version Number */
    unsigned short release_number;
    /** Manufacturer String */
    wchar_t *manufacturer_string;
    /** Product string */
    wchar_t *product_string;
    /** Usage Page for this Device/Interface
        (Windows/Mac/hidraw only) */
    unsigned short usage_page;
    /** Usage for this Device/Interface
        (Windows/Mac/hidraw only) */
    unsigned short usage;
    /** The USB interface which this logical device
        represents.

        Valid only if the device is a USB HID device.
        Set to -1 in all other cases.
    */
    int interface_number;

    /** Additional information about the USB interface.
        Valid on libusb and Android implementations. */
    int interface_class;
    int interface_subclass;
    int interface_protocol;

    /** Underlying bus type */
    SDL_hid_bus_type bus_type;

    /** Pointer to the next device */
    struct SDL_hid_device_info *next;

} SDL_hid_device_info;

πŸ’… DESCRIPTION πŸ’…

no cap, this struct is the whole dossier on one HID device. here's the field-by-field breakdown, because every single one of these matters and I'm not gatekeeping πŸ™ˆ

  • char *path β€” the platform-specific device path. it's giving "where u at" but for hardware.
  • unsigned short vendor_id β€” the Device Vendor ID 🏷️
  • unsigned short product_id β€” the Device Product ID 🏷️
  • wchar_t *serial_number β€” the Serial Number πŸ”’
  • unsigned short release_number β€” the Device Release Number in binary-coded decimal, also known as the Device Version Number. two names, one field, iconic behavior honestly πŸ‘‘
  • wchar_t *manufacturer_string β€” the Manufacturer String 🏭
  • wchar_t *product_string β€” the Product string πŸ“¦
  • unsigned short usage_page β€” the Usage Page for this Device/Interface. Windows/Mac/hidraw only, so don't come for it on other platforms πŸ’€
  • unsigned short usage β€” the Usage for this Device/Interface. also Windows/Mac/hidraw only bestie, same rules apply 🫢
  • int interface_number β€” the USB interface which this logical device represents. valid only if the device is a USB HID device, and it's Set to -1 in all other cases. so like, check before u assume βœ‹
  • int interface_class β€” Additional information about the USB interface. valid on libusb and Android implementations ✨
  • int interface_subclass β€” also Additional information about the USB interface, same deal: libusb and Android implementations only.
  • int interface_protocol β€” yeah bestie, also Additional information about the USB interface, and again valid on libusb and Android implementations.
  • SDL_hid_bus_type bus_type β€” the Underlying bus type 🚌 no literally, bus type.
  • struct SDL_hid_device_info *next β€” a Pointer to the next device πŸ”— it's a linked list, the way that it just chains them together... obsessed.
heads up: interface_number is -1 whenever the device isn't a USB HID device, and usage_page / usage are only a thing on Windows, Mac and hidraw. don't be surprised, it's in the struct comments fr fr.

🌈 AVAILABILITY 🌈

This struct is available since SDL 3.2.0 ✨


okay that's the whole page, you ate that πŸ“ go forth and enumerate ur HID devices with main character energy. iykyk πŸ’œ

Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_hid_device_info(3type) β€” mwah, catch u in the next manpage bestie πŸ§šπŸ’–

πŸ“¦ where this page comes from