MCPcopy Create free account
hub / github.com/Atarity/Lightpack / get_first_language

Function get_first_language

Software/src/hidapi/linux/hid-libusb.c:258–273  ·  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

256/* Get the first language the device says it reports. This comes from
257 USB string #0. */
258static uint16_t get_first_language(libusb_device_handle *dev)
259{
260 uint16_t buf[32];
261 int len;
262
263 /* Get the string from libusb. */
264 len = libusb_get_string_descriptor(dev,
265 0x0, /* String ID */
266 0x0, /* Language */
267 (unsigned char*)buf,
268 sizeof(buf));
269 if (len < 4)
270 return 0x0;
271
272 return buf[1]; // First two bytes are len and descriptor type.
273}
274
275static int is_language_supported(libusb_device_handle *dev, uint16_t lang)
276{

Callers 1

get_usb_stringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected