MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / libusb_get_string_descriptor

Function libusb_get_string_descriptor

lib/hidapi/libusb/hid.c:340–349  ·  view source on GitHub ↗

The libusb version included in FreeBSD < 10 doesn't have this function. In mainline libusb, it's inlined in libusb.h. This function will bear a striking resemblance to that one, because there's about one way to code it. Note that the data parameter is Unicode in UTF-16LE encoding. Return value is the number of bytes in data, or LIBUSB_ERROR_*. */

Source from the content-addressed store, hash-verified

338 Return value is the number of bytes in data, or LIBUSB_ERROR_*.
339 */
340static inline int libusb_get_string_descriptor(libusb_device_handle *dev,
341 uint8_t descriptor_index, uint16_t lang_id,
342 unsigned char *data, int length)
343{
344 return libusb_control_transfer(dev,
345 LIBUSB_ENDPOINT_IN | 0x0, /* Endpoint 0 IN */
346 LIBUSB_REQUEST_GET_DESCRIPTOR,
347 (LIBUSB_DT_STRING << 8) | descriptor_index,
348 lang_id, data, (uint16_t) length, 1000);
349}
350
351#endif
352

Callers 3

get_first_languageFunction · 0.85
is_language_supportedFunction · 0.85
get_usb_stringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected