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