Storage: speedup write_chunk cli command (#3173)

* Storage: speedup write_chunk cli command

* Storage: handle disconnect on write_chunk correctly
This commit is contained in:
あく 2023-10-30 23:51:51 +09:00 committed by GitHub
parent 0fe93fcfa4
commit 176fb21f5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -333,11 +333,9 @@ static void storage_cli_write_chunk(Cli* cli, FuriString* path, FuriString* args
if(buffer_size) {
uint8_t* buffer = malloc(buffer_size);
for(uint32_t i = 0; i < buffer_size; i++) {
buffer[i] = cli_getc(cli);
}
size_t read_bytes = cli_read(cli, buffer, buffer_size);
uint16_t written_size = storage_file_write(file, buffer, buffer_size);
uint16_t written_size = storage_file_write(file, buffer, read_bytes);
if(written_size != buffer_size) {
storage_cli_print_error(storage_file_get_error(file));