diff options
author | Tom Rini <trini@konsulko.com> | 2024-01-11 10:03:51 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-01-11 10:03:51 -0500 |
commit | d3dba8a28bb7f57a4558c944f9c329c467144633 (patch) | |
tree | 517ec69555b6f0f1dafd0f114ec67c7b9ddbcdf0 /include | |
parent | 7a59d520ef0bfd29b339cba5282149271d5ac3b2 (diff) | |
parent | 6c2f753f4ad3dcee60190949d1286736a6d51d17 (diff) | |
download | u-boot-d3dba8a28bb7f57a4558c944f9c329c467144633.zip u-boot-d3dba8a28bb7f57a4558c944f9c329c467144633.tar.gz u-boot-d3dba8a28bb7f57a4558c944f9c329c467144633.tar.bz2 |
Merge tag 'u-boot-dfu-20240111' of https://source.denx.de/u-boot/custodians/u-boot-dfu
u-boot-dfu-20240111
- Implement fastboot multi-response. This allows multi-line response and
most importantly, finally adds support for fastboot getvar all command.
- New 'fastboot oem console' command. Useful for debugging to send data
the u-boot shell via fastboot
- Console recording fixes
Diffstat (limited to 'include')
-rw-r--r-- | include/console.h | 13 | ||||
-rw-r--r-- | include/fastboot-internal.h | 7 | ||||
-rw-r--r-- | include/fastboot.h | 19 | ||||
-rw-r--r-- | include/membuff.h | 5 |
4 files changed, 42 insertions, 2 deletions
diff --git a/include/console.h b/include/console.h index e29817e..2617e16 100644 --- a/include/console.h +++ b/include/console.h @@ -85,6 +85,13 @@ int console_record_readline(char *str, int maxlen); int console_record_avail(void); /** + * console_record_isempty() - Returns if console output is empty + * + * Return: true if empty + */ +bool console_record_isempty(void); + +/** * console_in_puts() - Write a string to the console input buffer * * This writes the given string to the console_in buffer which will then be @@ -131,6 +138,12 @@ static inline int console_in_puts(const char *str) return 0; } +static inline bool console_record_isempty(void) +{ + /* Always empty */ + return true; +} + #endif /* !CONFIG_CONSOLE_RECORD */ /** diff --git a/include/fastboot-internal.h b/include/fastboot-internal.h index bf2f2b3..610d4f9 100644 --- a/include/fastboot-internal.h +++ b/include/fastboot-internal.h @@ -19,6 +19,13 @@ extern u32 fastboot_buf_size; extern void (*fastboot_progress_callback)(const char *msg); /** + * fastboot_getvar_all() - Writes current variable being listed from "all" to response. + * + * @response: Pointer to fastboot response buffer + */ +void fastboot_getvar_all(char *response); + +/** * fastboot_getvar() - Writes variable indicated by cmd_parameter to response. * * @cmd_parameter: Pointer to command parameter diff --git a/include/fastboot.h b/include/fastboot.h index 296451f..1e7920e 100644 --- a/include/fastboot.h +++ b/include/fastboot.h @@ -14,6 +14,16 @@ #define FASTBOOT_VERSION "0.4" +/* + * Signals u-boot fastboot code to send multiple responses by + * calling response generating function repeatedly until a OKAY/FAIL + * is generated as final response. + * + * This status code is only used internally to signal, must NOT + * be sent to host. + */ +#define FASTBOOT_MULTIRESPONSE_START ("MORE") + /* The 64 defined bytes plus \0 */ #define FASTBOOT_COMMAND_LEN (64 + 1) #define FASTBOOT_RESPONSE_LEN (64 + 1) @@ -37,6 +47,7 @@ enum { FASTBOOT_COMMAND_OEM_PARTCONF, FASTBOOT_COMMAND_OEM_BOOTBUS, FASTBOOT_COMMAND_OEM_RUN, + FASTBOOT_COMMAND_OEM_CONSOLE, FASTBOOT_COMMAND_ACMD, FASTBOOT_COMMAND_UCMD, FASTBOOT_COMMAND_COUNT @@ -172,5 +183,13 @@ void fastboot_data_download(const void *fastboot_data, */ void fastboot_data_complete(char *response); +/** + * fastboot_handle_multiresponse() - Called for each response to send + * + * @cmd: Command id that requested multiresponse + * @response: Pointer to fastboot response buffer + */ +void fastboot_multiresponse(int cmd, char *response); + void fastboot_acmd_complete(void); #endif /* _FASTBOOT_H_ */ diff --git a/include/membuff.h b/include/membuff.h index 21051b0..4eba626 100644 --- a/include/membuff.h +++ b/include/membuff.h @@ -192,10 +192,11 @@ int membuff_free(struct membuff *mb); * @mb: membuff to adjust * @str: Place to put the line * @maxlen: Maximum line length (excluding terminator) + * @must_fit: If true then str is empty if line doesn't fit * Return: number of bytes read (including terminator) if a line has been - * read, 0 if nothing was there + * read, 0 if nothing was there or line didn't fit when must_fit is set */ -int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch); +int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit); /** * membuff_extend_by() - expand a membuff |