From 442f6237f6d0ca9c45a18d9a2e2cf88a362d619d Mon Sep 17 00:00:00 2001 From: fang hui Date: Mon, 19 Dec 2016 14:02:02 +0800 Subject: MA-9119 - [IOT] iot-flashall-imx6ul.sh some times exit as "ERROR: device is LOCKed!" The issue occurs when the "fbmisc" partition is empty. So the decode data is not same as plain text, then goto lock status. When "gpt" change from invalid to valid, set unlock status can fix it. When set unlock status, will fist check current status, if unlock, do nothing. In the previous code, when check lock status, since not re-load partition table to memory, fail to find "fbmisc" partition, So just return unlock status. To fix it, when "gpt" change from invalid to valid, fisrt re-load partition table, then set unlock status. Change-Id: Iec6cfe6bf1030b986d2b839f9c81a3e048d91dcd Signed-off-by: fang hui --- drivers/usb/gadget/f_fastboot.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) mode change 100644 => 100755 drivers/usb/gadget/f_fastboot.c diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c old mode 100644 new mode 100755 index 31969d8..b1382dd --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -3097,15 +3097,16 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req) if (strncmp(cmd, "gpt", 3) == 0) { gpt_valid_pst = partition_table_valid(); - /* If gpt invalid -> valid, write unlock status, also wipe data. */ - if ((gpt_valid_pre == 0) && (gpt_valid_pst == 1)) - do_fastboot_unlock(); - /* If gpt is valid, load partitons table into memory. So if the next command is "fastboot reboot bootloader", it can find the "misc" partition to r/w. */ if(gpt_valid_pst) _fastboot_load_partitions(); + + /* If gpt invalid -> valid, write unlock status, also wipe data. */ + if ((gpt_valid_pre == 0) && (gpt_valid_pst == 1)) { + do_fastboot_unlock(); + } } #endif #else -- cgit v1.1