diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2016-12-10 14:13:14 +0100 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2016-12-10 14:13:14 +0100 |
commit | 8f57f7ef61fe2f439422d5dc313d2005d8adc370 (patch) | |
tree | 301c7a5259b0a05e5490817b8706d675534ca978 | |
parent | 3d71caab8ffda2f6f001a75090e0843361c86ca6 (diff) | |
download | 0xFFFF-8f57f7ef61fe2f439422d5dc313d2005d8adc370.tar.bz2 |
mkii: Fix detection of Update mode
-rw-r--r-- | src/mkii.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -159,7 +159,8 @@ int mkii_init(struct usb_device_info * dev) { printf("\n"); memset(buf, 0, sizeof(buf)); - usb_get_string_simple(dev->udev, usb_device(dev->udev)->config[dev->flash_device->configuration].iConfiguration, buf, sizeof(buf)); + if ( usb_device(dev->udev)->descriptor.bNumConfigurations >= 1 ) + usb_get_string_simple(dev->udev, usb_device(dev->udev)->config[0].iConfiguration, buf, sizeof(buf)); if ( strncmp(buf, "Firmware Upgrade Configuration", sizeof("Firmware Upgrade Configuration")) == 0 ) dev->data |= MKII_UPDATE_MODE; |