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

Function get_first_language

lib/hidapi/libusb/hid.c:356–371  ·  view source on GitHub ↗

Get the first language the device says it reports. This comes from USB string #0. */

Source from the content-addressed store, hash-verified

354/* Get the first language the device says it reports. This comes from
355 USB string #0. */
356static uint16_t get_first_language(libusb_device_handle *dev)
357{
358 uint16_t buf[32];
359 int len;
360
361 /* Get the string from libusb. */
362 len = libusb_get_string_descriptor(dev,
363 0x0, /* String ID */
364 0x0, /* Language */
365 (unsigned char*)buf,
366 sizeof(buf));
367 if (len < 4)
368 return 0x0;
369
370 return buf[1]; /* First two bytes are len and descriptor type. */
371}
372
373static int is_language_supported(libusb_device_handle *dev, uint16_t lang)
374{

Callers 1

get_usb_stringFunction · 0.85

Calls 1

Tested by

no test coverage detected