Get the first language the device says it reports. This comes from USB string #0. */
| 354 | /* Get the first language the device says it reports. This comes from |
| 355 | USB string #0. */ |
| 356 | static 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 | |
| 373 | static int is_language_supported(libusb_device_handle *dev, uint16_t lang) |
| 374 | { |
no test coverage detected