summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2016-12-10 14:13:14 +0100
committerPali Rohár <pali.rohar@gmail.com>2016-12-10 14:13:14 +0100
commit8f57f7ef61fe2f439422d5dc313d2005d8adc370 (patch)
tree301c7a5259b0a05e5490817b8706d675534ca978
parent3d71caab8ffda2f6f001a75090e0843361c86ca6 (diff)
download0xFFFF-8f57f7ef61fe2f439422d5dc313d2005d8adc370.tar.bz2
mkii: Fix detection of Update mode
-rw-r--r--src/mkii.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mkii.c b/src/mkii.c
index 0c6e655..6c8a0d6 100644
--- a/src/mkii.c
+++ b/src/mkii.c
@@ -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;