.\" This manpage content is licensed under Creative Commons
.\"  Attribution 4.0 International (CC BY 4.0)
.\"   https://creativecommons.org/licenses/by/4.0/
.\" This manpage was generated from SDL's wiki page for SDL_hid_write:
.\"   https://wiki.libsdl.org/SDL_hid_write
.\" Generated with SDL/build-scripts/wikiheaders.pl
.\"  revision release-3.2.8-0-gf6864924f
.\" Please report issues in this manpage's content at:
.\"   https://github.com/libsdl-org/sdlwiki/issues/new
.\" Please report issues in the generation of this manpage from the wiki at:
.\"   https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20SDL_hid_write
.\" SDL can be found at https://libsdl.org/
.de URL
\$2 \(laURL: \$1 \(ra\$3
..
.if \n[.g] .mso www.tmac
.TH SDL_hid_write 3 "SDL 3.2.8" "Simple Directmedia Layer" "SDL3 FUNCTIONS"
.SH NAME
SDL_hid_write \- Write an Output report to a HID device\[char46]
.SH HEADER FILE
Defined in SDL3/SDL_hidapi\[char46]h

.SH SYNOPSIS
.nf
.B #include \(dqSDL3/SDL.h\(dq
.PP
.BI "int SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
.fi
.SH DESCRIPTION
The first byte of
.BR data
must contain the Report ID\[char46] For devices which only
support a single report, this must be set to 0x0\[char46] The remaining bytes
contain the report data\[char46] Since the Report ID is mandatory, calls to

.BR SDL_hid_write
() will always contain one more byte than the
report contains\[char46] For example, if a hid report is 16 bytes long, 17 bytes
must be passed to 
.BR SDL_hid_write
(), the Report ID (or 0x0,
for devices with a single report), followed by the report data (16 bytes)\[char46]
In this example, the length passed in would be 17\[char46]


.BR SDL_hid_write
() will send the data on the first OUT
endpoint, if one exists\[char46] If it does not, it will send the data through the
Control Endpoint (Endpoint 0)\[char46]

.SH FUNCTION PARAMETERS
.TP
.I dev
a device handle returned from 
.BR SDL_hid_open
()\[char46]
.TP
.I data
the data to send, including the report number as the first byte\[char46]
.TP
.I length
the length in bytes of the data to send\[char46]
.SH RETURN VALUE
Returns the actual number of bytes written and -1 on on failure; call

.BR SDL_GetError
() for more information\[char46]

.SH AVAILABILITY
This function is available since SDL 3\[char46]2\[char46]0\[char46]