Merge branch '2022-01-28-fastboot-updates'

- 3 DFU/fastboot bugfixes
This commit is contained in:
Tom Rini 2022-01-28 12:13:23 -05:00
commit 2d0953c0e0
3 changed files with 13 additions and 16 deletions

View file

@ -91,7 +91,7 @@ void fastboot_okay(const char *reason, char *response)
*/ */
int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) int __weak fastboot_set_reboot_flag(enum fastboot_reboot_reason reason)
{ {
#if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC_DEV) #ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
static const char * const boot_cmds[] = { static const char * const boot_cmds[] = {
[FASTBOOT_REBOOT_REASON_BOOTLOADER] = "bootonce-bootloader", [FASTBOOT_REBOOT_REASON_BOOTLOADER] = "bootonce-bootloader",
[FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot", [FASTBOOT_REBOOT_REASON_FASTBOOTD] = "boot-fastboot",

View file

@ -104,23 +104,18 @@ static int part_get_info_by_name_or_alias(struct blk_desc **dev_desc,
const char *name, const char *name,
struct disk_partition *info) struct disk_partition *info)
{ {
int ret;
ret = do_get_part_info(dev_desc, name, info);
if (ret < 0) {
/* strlen("fastboot_partition_alias_") + PART_NAME_LEN + 1 */ /* strlen("fastboot_partition_alias_") + PART_NAME_LEN + 1 */
char env_alias_name[25 + PART_NAME_LEN + 1]; char env_alias_name[25 + PART_NAME_LEN + 1];
char *aliased_part_name; char *aliased_part_name;
/* check for alias */ /* check for alias */
strcpy(env_alias_name, "fastboot_partition_alias_"); strlcpy(env_alias_name, "fastboot_partition_alias_", sizeof(env_alias_name));
strlcat(env_alias_name, name, sizeof(env_alias_name)); strlcat(env_alias_name, name, sizeof(env_alias_name));
aliased_part_name = env_get(env_alias_name); aliased_part_name = env_get(env_alias_name);
if (aliased_part_name != NULL) if (aliased_part_name)
ret = do_get_part_info(dev_desc, aliased_part_name, name = aliased_part_name;
info);
} return do_get_part_info(dev_desc, name, info);
return ret;
} }
/** /**

View file

@ -336,6 +336,8 @@ static int state_dfu_idle(struct f_dfu *f_dfu,
f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE; f_dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
f_dfu->blk_seq_num = 0; f_dfu->blk_seq_num = 0;
value = handle_upload(req, len); value = handle_upload(req, len);
if (value >= 0 && value < len)
f_dfu->dfu_state = DFU_STATE_dfuIDLE;
break; break;
case USB_REQ_DFU_ABORT: case USB_REQ_DFU_ABORT:
/* no zlp? */ /* no zlp? */