MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / return_data

Function return_data

dependencies/hidapi/hidapi.c:924–936  ·  view source on GitHub ↗

Helper function, to simplify hid_read(). This should be called with dev->mutex locked. */

Source from the content-addressed store, hash-verified

922/* Helper function, to simplify hid_read().
923 This should be called with dev->mutex locked. */
924static int return_data(hid_device *dev, unsigned char *data, size_t length)
925{
926 /* Copy the data out of the linked list item (rpt) into the
927 return buffer (data), and delete the liked list item. */
928 struct input_report *rpt = dev->input_reports;
929 size_t len = (length < rpt->len)? length: rpt->len;
930 if (len > 0)
931 memcpy(data, rpt->data, len);
932 dev->input_reports = rpt->next;
933 free(rpt->data);
934 free(rpt);
935 return len;
936}
937
938static void cleanup_mutex(void *param)
939{

Callers 3

read_callbackFunction · 0.85
hid_read_timeoutFunction · 0.85
hid_closeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected