Move checking for flashing protocol from main to cold-flash
This commit is contained in:
1 parent
32f2e53304
commit
8eb58ad08c
2 files changed
+16
-7
No files matched your search
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "cold-flash.h"
|
||||
#include "image.h"
|
||||
#include "usb-device.h"
|
||||
#include "printf-utils.h"
|
||||
|
||||
#define READ_DEV 0x81
|
||||
#define WRITE_DEV 0x01
|
||||
@@ -307,6 +309,11 @@ static int ping_timeout(usb_dev_handle * udev) {
|
||||
|
||||
int cold_flash(struct usb_device_info * dev, struct image * x2nd, struct image * secondary) {
|
||||
|
||||
if ( dev->flash_device->protocol != FLASH_COLD ) {
|
||||
printf_and_wait("Device is not in Cold Flash mode\nUnplug USB cable, turn device off, press ENTER and plug USB cable again");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( x2nd->type != IMAGE_2ND ) {
|
||||
fprintf(stderr, "Image type is not 2nd X-Loader\n");
|
||||
return 1;
|
||||
@@ -346,6 +353,11 @@ int leave_cold_flash(struct usb_device_info * dev) {
|
||||
|
||||
int ret;
|
||||
|
||||
if ( dev->flash_device->protocol != FLASH_COLD ) {
|
||||
fprintf(stderr, "Device is not in Cold Flash mode\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( ! read_asic(dev->udev) ) {
|
||||
fprintf(stderr, "Reading ASIC ID failed\n");
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user