Skip to content

Commit

Permalink
Storage: speedup write_chunk cli command (#3173)
Browse files Browse the repository at this point in the history
* Storage: speedup write_chunk cli command

* Storage: handle disconnect on write_chunk correctly
  • Loading branch information
skotopes authored Oct 30, 2023
1 parent 0fe93fc commit 176fb21
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions applications/services/storage/storage_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 176fb21

Please sign in to comment.