operations: Check for supported image types in dev_flash_image

This commit is contained in:
Pali Rohár committed 2014-11-21 17:16:44 +01:00
1 parent 6372323ee8
commit f1095777c6
1 file changed
+9 -4
+9 -4
View File
@@ -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; enum usb_flash_protocol protocol = dev->usb->flash_device->protocol;
if ( protocol == FLASH_NOLO ) if ( protocol == FLASH_NOLO ) {
return nolo_flash_image(dev->usb, image); if ( image->type != IMAGE_MMC )
else if ( protocol == FLASH_MKII ) return nolo_flash_image(dev->usb, image);
return mkii_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); usb_switch_to_nolo(dev->usb);
return -EAGAIN; return -EAGAIN;