From f1095777c6c92f284ba2a8eb8b08a21476e4cb5f Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Fri, 21 Nov 2014 17:16:44 +0100 Subject: operations: Check for supported image types in dev_flash_image --- src/operations.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/operations.c') diff --git a/src/operations.c b/src/operations.c index 6696fe1..10ad975 100644 --- a/src/operations.c +++ b/src/operations.c @@ -174,10 +174,15 @@ int dev_flash_image(struct device_info * dev, struct image * image) { enum usb_flash_protocol protocol = dev->usb->flash_device->protocol; - if ( protocol == FLASH_NOLO ) - return nolo_flash_image(dev->usb, image); - else if ( protocol == FLASH_MKII ) - return mkii_flash_image(dev->usb, image); + if ( protocol == FLASH_NOLO ) { + if ( image->type != IMAGE_MMC ) + return nolo_flash_image(dev->usb, image); + usb_switch_to_update(dev->usb); + return -EAGAIN; + } else if ( protocol == FLASH_MKII ) { + if ( dev->usb->data & (1 << image->type) ) + return mkii_flash_image(dev->usb, image); + } usb_switch_to_nolo(dev->usb); return -EAGAIN; -- cgit v1.2.3