fastboot: split cb_getvar into dedicate functions

The old implementation of cb_getvar is programed in one functions, this
make the cb_getvar huge. So separate cb_getvar in several functions.

Functions:
fb_getvar_all: Get all parameters by cmd fastboot
               getvar all.
fb_getvar_single: Get one parameter by cmd fastboot
                  getvar xxx.
fb_read_var: Parse parameters

Change-Id: I1e795228f8129af82702f8f315cbad349ceec451
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is contained in:
Jason Zhu 2018-03-05 22:26:43 +08:00 committed by Kever Yang
parent 42784e282f
commit 90d27e7fed
2 changed files with 881 additions and 244 deletions

999
drivers/usb/gadget/f_fastboot.c Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,40 @@
/* The 64 defined bytes plus \0 */
#define FASTBOOT_RESPONSE_LEN (64 + 1)
/* Fastboot getvar variables */
typedef enum {
FB_VERSION,
FB_BOOTLOADER_VERSION,
FB_BASEBAND_VERSION,
FB_PRODUCT,
FB_SERIAL_NO,
FB_SECURE,
FB_DWNLD_SIZE,
FB_BLK_SIZE,
FB_ERASE_SIZE,
FB_PART_TYPE,
FB_PART_SIZE,
FB_UNLOCKED,
FB_VARIANT,
FB_OFF_MODE_CHARGE,
FB_BATT_VOLTAGE,
FB_BATT_SOC_OK,
#ifdef CONFIG_RK_AVB_LIBAVB_USER
FB_HAS_COUNT,
FB_HAS_SLOT,
FB_CURR_SLOT,
FB_SLOT_SUFFIXES,
FB_SLOT_SUCCESSFUL,
FB_SLOT_UNBOOTABLE,
FB_SLOT_RETRY_COUNT,
FB_AT_VBST,
#endif
#ifdef CONFIG_OPTEE_CLIENT
FB_AT_DH,
FB_AT_UUID,
#endif
} fb_getvar_t;
void fastboot_fail(const char *reason, char *response);
void fastboot_okay(const char *reason, char *response);