storage_cli.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. #include <furi.h>
  2. #include <furi_hal.h>
  3. #include <stm32_adafruit_sd.h>
  4. #include <cli/cli.h>
  5. #include <lib/toolbox/args.h>
  6. #include <lib/toolbox/md5.h>
  7. #include <lib/toolbox/dir_walk.h>
  8. #include <storage/storage.h>
  9. #include <storage/storage_sd_api.h>
  10. #include <power/power_service/power.h>
  11. #define MAX_NAME_LENGTH 255
  12. static void storage_cli_print_usage() {
  13. printf("Usage:\r\n");
  14. printf("storage <cmd> <path> <args>\r\n");
  15. printf("The path must start with /int or /ext\r\n");
  16. printf("Cmd list:\r\n");
  17. printf("\tinfo\t - get FS info\r\n");
  18. printf("\tformat\t - format filesystem\r\n");
  19. printf("\tlist\t - list files and dirs\r\n");
  20. printf("\ttree\t - list files and dirs, recursive\r\n");
  21. printf("\tremove\t - delete the file or directory\r\n");
  22. printf("\tread\t - read text from file and print file size and content to cli\r\n");
  23. printf(
  24. "\tread_chunks\t - read data from file and print file size and content to cli, <args> should contain how many bytes you want to read in block\r\n");
  25. printf("\twrite\t - read text from cli and append it to file, stops by ctrl+c\r\n");
  26. printf(
  27. "\twrite_chunk\t - read data from cli and append it to file, <args> should contain how many bytes you want to write\r\n");
  28. printf("\tcopy\t - copy file to new file, <args> must contain new path\r\n");
  29. printf("\trename\t - move file to new file, <args> must contain new path\r\n");
  30. printf("\tmkdir\t - creates a new directory\r\n");
  31. printf("\tmd5\t - md5 hash of the file\r\n");
  32. printf("\tstat\t - info about file or dir\r\n");
  33. printf("\ttimestamp\t - last modification timestamp\r\n");
  34. };
  35. static void storage_cli_print_error(FS_Error error) {
  36. printf("Storage error: %s\r\n", storage_error_get_desc(error));
  37. }
  38. static void storage_cli_info(Cli* cli, FuriString* path) {
  39. UNUSED(cli);
  40. Storage* api = furi_record_open(RECORD_STORAGE);
  41. if(furi_string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0) {
  42. uint64_t total_space;
  43. uint64_t free_space;
  44. FS_Error error =
  45. storage_common_fs_info(api, STORAGE_INT_PATH_PREFIX, &total_space, &free_space);
  46. if(error != FSE_OK) {
  47. storage_cli_print_error(error);
  48. } else {
  49. printf(
  50. "Label: %s\r\nType: LittleFS\r\n%luKiB total\r\n%luKiB free\r\n",
  51. furi_hal_version_get_name_ptr() ? furi_hal_version_get_name_ptr() : "Unknown",
  52. (uint32_t)(total_space / 1024),
  53. (uint32_t)(free_space / 1024));
  54. }
  55. } else if(furi_string_cmp_str(path, STORAGE_EXT_PATH_PREFIX) == 0) {
  56. SDInfo sd_info;
  57. SD_CID sd_cid;
  58. FS_Error error = storage_sd_info(api, &sd_info);
  59. BSP_SD_GetCIDRegister(&sd_cid);
  60. if(error != FSE_OK) {
  61. storage_cli_print_error(error);
  62. } else {
  63. printf(
  64. "Label: %s\r\nType: %s\r\n%luKiB total\r\n%luKiB free\r\n"
  65. "%02x%2.2s %5.5s %i.%i\r\nSN:%04lx %02i/%i\r\n",
  66. sd_info.label,
  67. sd_api_get_fs_type_text(sd_info.fs_type),
  68. sd_info.kb_total,
  69. sd_info.kb_free,
  70. sd_cid.ManufacturerID,
  71. sd_cid.OEM_AppliID,
  72. sd_cid.ProdName,
  73. sd_cid.ProdRev >> 4,
  74. sd_cid.ProdRev & 0xf,
  75. sd_cid.ProdSN,
  76. sd_cid.ManufactMonth,
  77. sd_cid.ManufactYear + 2000);
  78. }
  79. } else {
  80. storage_cli_print_usage();
  81. }
  82. furi_record_close(RECORD_STORAGE);
  83. };
  84. static void storage_cli_format(Cli* cli, FuriString* path) {
  85. if(furi_string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0) {
  86. storage_cli_print_error(FSE_NOT_IMPLEMENTED);
  87. } else if(furi_string_cmp_str(path, STORAGE_EXT_PATH_PREFIX) == 0) {
  88. printf("Formatting SD card, All data will be lost! Are you sure (y/n)?\r\n");
  89. char answer = cli_getc(cli);
  90. if(answer == 'y' || answer == 'Y') {
  91. Storage* api = furi_record_open(RECORD_STORAGE);
  92. printf("Formatting, please wait...\r\n");
  93. FS_Error error = storage_sd_format(api);
  94. if(error != FSE_OK) {
  95. storage_cli_print_error(error);
  96. } else {
  97. printf("SD card was successfully formatted.\r\n");
  98. }
  99. furi_record_close(RECORD_STORAGE);
  100. } else {
  101. printf("Cancelled.\r\n");
  102. }
  103. } else {
  104. storage_cli_print_usage();
  105. }
  106. };
  107. static void storage_cli_list(Cli* cli, FuriString* path) {
  108. UNUSED(cli);
  109. if(furi_string_cmp_str(path, "/") == 0) {
  110. printf("\t[D] int\r\n");
  111. printf("\t[D] ext\r\n");
  112. printf("\t[D] any\r\n");
  113. } else {
  114. Storage* api = furi_record_open(RECORD_STORAGE);
  115. File* file = storage_file_alloc(api);
  116. if(storage_dir_open(file, furi_string_get_cstr(path))) {
  117. FileInfo fileinfo;
  118. char name[MAX_NAME_LENGTH];
  119. bool read_done = false;
  120. while(storage_dir_read(file, &fileinfo, name, MAX_NAME_LENGTH)) {
  121. read_done = true;
  122. if(fileinfo.flags & FSF_DIRECTORY) {
  123. printf("\t[D] %s\r\n", name);
  124. } else {
  125. printf("\t[F] %s %lub\r\n", name, (uint32_t)(fileinfo.size));
  126. }
  127. }
  128. if(!read_done) {
  129. printf("\tEmpty\r\n");
  130. }
  131. } else {
  132. storage_cli_print_error(storage_file_get_error(file));
  133. }
  134. storage_dir_close(file);
  135. storage_file_free(file);
  136. furi_record_close(RECORD_STORAGE);
  137. }
  138. }
  139. static void storage_cli_tree(Cli* cli, FuriString* path) {
  140. if(furi_string_cmp_str(path, "/") == 0) {
  141. furi_string_set(path, STORAGE_INT_PATH_PREFIX);
  142. storage_cli_tree(cli, path);
  143. furi_string_set(path, STORAGE_EXT_PATH_PREFIX);
  144. storage_cli_tree(cli, path);
  145. } else {
  146. Storage* api = furi_record_open(RECORD_STORAGE);
  147. DirWalk* dir_walk = dir_walk_alloc(api);
  148. FuriString* name;
  149. name = furi_string_alloc();
  150. if(dir_walk_open(dir_walk, furi_string_get_cstr(path))) {
  151. FileInfo fileinfo;
  152. bool read_done = false;
  153. while(dir_walk_read(dir_walk, name, &fileinfo) == DirWalkOK) {
  154. read_done = true;
  155. if(fileinfo.flags & FSF_DIRECTORY) {
  156. printf("\t[D] %s\r\n", furi_string_get_cstr(name));
  157. } else {
  158. printf(
  159. "\t[F] %s %lub\r\n",
  160. furi_string_get_cstr(name),
  161. (uint32_t)(fileinfo.size));
  162. }
  163. }
  164. if(!read_done) {
  165. printf("\tEmpty\r\n");
  166. }
  167. } else {
  168. storage_cli_print_error(dir_walk_get_error(dir_walk));
  169. }
  170. furi_string_free(name);
  171. dir_walk_free(dir_walk);
  172. furi_record_close(RECORD_STORAGE);
  173. }
  174. }
  175. static void storage_cli_read(Cli* cli, FuriString* path) {
  176. UNUSED(cli);
  177. Storage* api = furi_record_open(RECORD_STORAGE);
  178. File* file = storage_file_alloc(api);
  179. if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
  180. const uint16_t buffer_size = 128;
  181. uint16_t read_size = 0;
  182. uint8_t* data = malloc(buffer_size);
  183. printf("Size: %lu\r\n", (uint32_t)storage_file_size(file));
  184. do {
  185. read_size = storage_file_read(file, data, buffer_size);
  186. for(uint16_t i = 0; i < read_size; i++) {
  187. printf("%c", data[i]);
  188. }
  189. } while(read_size > 0);
  190. printf("\r\n");
  191. free(data);
  192. } else {
  193. storage_cli_print_error(storage_file_get_error(file));
  194. }
  195. storage_file_close(file);
  196. storage_file_free(file);
  197. furi_record_close(RECORD_STORAGE);
  198. }
  199. static void storage_cli_write(Cli* cli, FuriString* path) {
  200. Storage* api = furi_record_open(RECORD_STORAGE);
  201. File* file = storage_file_alloc(api);
  202. const uint16_t buffer_size = 512;
  203. uint8_t* buffer = malloc(buffer_size);
  204. if(storage_file_open(file, furi_string_get_cstr(path), FSAM_WRITE, FSOM_OPEN_APPEND)) {
  205. printf("Just write your text data. New line by Ctrl+Enter, exit by Ctrl+C.\r\n");
  206. uint32_t read_index = 0;
  207. while(true) {
  208. uint8_t symbol = cli_getc(cli);
  209. if(symbol == CliSymbolAsciiETX) {
  210. uint16_t write_size = read_index % buffer_size;
  211. if(write_size > 0) {
  212. uint16_t written_size = storage_file_write(file, buffer, write_size);
  213. if(written_size != write_size) {
  214. storage_cli_print_error(storage_file_get_error(file));
  215. }
  216. break;
  217. }
  218. }
  219. buffer[read_index % buffer_size] = symbol;
  220. printf("%c", buffer[read_index % buffer_size]);
  221. fflush(stdout);
  222. read_index++;
  223. if(((read_index % buffer_size) == 0)) {
  224. uint16_t written_size = storage_file_write(file, buffer, buffer_size);
  225. if(written_size != buffer_size) {
  226. storage_cli_print_error(storage_file_get_error(file));
  227. break;
  228. }
  229. }
  230. }
  231. printf("\r\n");
  232. } else {
  233. storage_cli_print_error(storage_file_get_error(file));
  234. }
  235. storage_file_close(file);
  236. free(buffer);
  237. storage_file_free(file);
  238. furi_record_close(RECORD_STORAGE);
  239. }
  240. static void storage_cli_read_chunks(Cli* cli, FuriString* path, FuriString* args) {
  241. Storage* api = furi_record_open(RECORD_STORAGE);
  242. File* file = storage_file_alloc(api);
  243. uint32_t buffer_size;
  244. int parsed_count = sscanf(furi_string_get_cstr(args), "%lu", &buffer_size);
  245. if(parsed_count != 1) {
  246. storage_cli_print_usage();
  247. } else if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
  248. uint64_t file_size = storage_file_size(file);
  249. printf("Size: %lu\r\n", (uint32_t)file_size);
  250. if(buffer_size) {
  251. uint8_t* data = malloc(buffer_size);
  252. while(file_size > 0) {
  253. printf("\r\nReady?\r\n");
  254. cli_getc(cli);
  255. uint16_t read_size = storage_file_read(file, data, buffer_size);
  256. for(uint16_t i = 0; i < read_size; i++) {
  257. putchar(data[i]);
  258. }
  259. file_size -= read_size;
  260. }
  261. free(data);
  262. }
  263. printf("\r\n");
  264. } else {
  265. storage_cli_print_error(storage_file_get_error(file));
  266. }
  267. storage_file_close(file);
  268. storage_file_free(file);
  269. furi_record_close(RECORD_STORAGE);
  270. }
  271. static void storage_cli_write_chunk(Cli* cli, FuriString* path, FuriString* args) {
  272. Storage* api = furi_record_open(RECORD_STORAGE);
  273. File* file = storage_file_alloc(api);
  274. uint32_t buffer_size;
  275. int parsed_count = sscanf(furi_string_get_cstr(args), "%lu", &buffer_size);
  276. if(parsed_count != 1) {
  277. storage_cli_print_usage();
  278. } else {
  279. if(storage_file_open(file, furi_string_get_cstr(path), FSAM_WRITE, FSOM_OPEN_APPEND)) {
  280. printf("Ready\r\n");
  281. if(buffer_size) {
  282. uint8_t* buffer = malloc(buffer_size);
  283. for(uint32_t i = 0; i < buffer_size; i++) {
  284. buffer[i] = cli_getc(cli);
  285. }
  286. uint16_t written_size = storage_file_write(file, buffer, buffer_size);
  287. if(written_size != buffer_size) {
  288. storage_cli_print_error(storage_file_get_error(file));
  289. }
  290. free(buffer);
  291. }
  292. } else {
  293. storage_cli_print_error(storage_file_get_error(file));
  294. }
  295. storage_file_close(file);
  296. }
  297. storage_file_free(file);
  298. furi_record_close(RECORD_STORAGE);
  299. }
  300. static void storage_cli_stat(Cli* cli, FuriString* path) {
  301. UNUSED(cli);
  302. Storage* api = furi_record_open(RECORD_STORAGE);
  303. if(furi_string_cmp_str(path, "/") == 0) {
  304. printf("Storage\r\n");
  305. } else if(
  306. furi_string_cmp_str(path, STORAGE_EXT_PATH_PREFIX) == 0 ||
  307. furi_string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0 ||
  308. furi_string_cmp_str(path, STORAGE_ANY_PATH_PREFIX) == 0) {
  309. uint64_t total_space;
  310. uint64_t free_space;
  311. FS_Error error =
  312. storage_common_fs_info(api, furi_string_get_cstr(path), &total_space, &free_space);
  313. if(error != FSE_OK) {
  314. storage_cli_print_error(error);
  315. } else {
  316. printf(
  317. "Storage, %luKiB total, %luKiB free\r\n",
  318. (uint32_t)(total_space / 1024),
  319. (uint32_t)(free_space / 1024));
  320. }
  321. } else {
  322. FileInfo fileinfo;
  323. FS_Error error = storage_common_stat(api, furi_string_get_cstr(path), &fileinfo);
  324. if(error == FSE_OK) {
  325. if(fileinfo.flags & FSF_DIRECTORY) {
  326. printf("Directory\r\n");
  327. } else {
  328. printf("File, size: %lub\r\n", (uint32_t)(fileinfo.size));
  329. }
  330. } else {
  331. storage_cli_print_error(error);
  332. }
  333. }
  334. furi_record_close(RECORD_STORAGE);
  335. }
  336. static void storage_cli_timestamp(Cli* cli, FuriString* path) {
  337. UNUSED(cli);
  338. Storage* api = furi_record_open(RECORD_STORAGE);
  339. uint32_t timestamp = 0;
  340. FS_Error error = storage_common_timestamp(api, furi_string_get_cstr(path), &timestamp);
  341. if(error != FSE_OK) {
  342. printf("Invalid arguments\r\n");
  343. } else {
  344. printf("Timestamp %lu\r\n", timestamp);
  345. }
  346. furi_record_close(RECORD_STORAGE);
  347. }
  348. static void storage_cli_copy(Cli* cli, FuriString* old_path, FuriString* args) {
  349. UNUSED(cli);
  350. Storage* api = furi_record_open(RECORD_STORAGE);
  351. FuriString* new_path;
  352. new_path = furi_string_alloc();
  353. if(!args_read_probably_quoted_string_and_trim(args, new_path)) {
  354. storage_cli_print_usage();
  355. } else {
  356. FS_Error error = storage_common_copy(
  357. api, furi_string_get_cstr(old_path), furi_string_get_cstr(new_path));
  358. if(error != FSE_OK) {
  359. storage_cli_print_error(error);
  360. }
  361. }
  362. furi_string_free(new_path);
  363. furi_record_close(RECORD_STORAGE);
  364. }
  365. static void storage_cli_remove(Cli* cli, FuriString* path) {
  366. UNUSED(cli);
  367. Storage* api = furi_record_open(RECORD_STORAGE);
  368. FS_Error error = storage_common_remove(api, furi_string_get_cstr(path));
  369. if(error != FSE_OK) {
  370. storage_cli_print_error(error);
  371. }
  372. furi_record_close(RECORD_STORAGE);
  373. }
  374. static void storage_cli_rename(Cli* cli, FuriString* old_path, FuriString* args) {
  375. UNUSED(cli);
  376. Storage* api = furi_record_open(RECORD_STORAGE);
  377. FuriString* new_path;
  378. new_path = furi_string_alloc();
  379. if(!args_read_probably_quoted_string_and_trim(args, new_path)) {
  380. storage_cli_print_usage();
  381. } else {
  382. FS_Error error = storage_common_rename(
  383. api, furi_string_get_cstr(old_path), furi_string_get_cstr(new_path));
  384. if(error != FSE_OK) {
  385. storage_cli_print_error(error);
  386. }
  387. }
  388. furi_string_free(new_path);
  389. furi_record_close(RECORD_STORAGE);
  390. }
  391. static void storage_cli_mkdir(Cli* cli, FuriString* path) {
  392. UNUSED(cli);
  393. Storage* api = furi_record_open(RECORD_STORAGE);
  394. FS_Error error = storage_common_mkdir(api, furi_string_get_cstr(path));
  395. if(error != FSE_OK) {
  396. storage_cli_print_error(error);
  397. }
  398. furi_record_close(RECORD_STORAGE);
  399. }
  400. static void storage_cli_md5(Cli* cli, FuriString* path) {
  401. UNUSED(cli);
  402. Storage* api = furi_record_open(RECORD_STORAGE);
  403. File* file = storage_file_alloc(api);
  404. if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
  405. const uint16_t buffer_size = 512;
  406. const uint8_t hash_size = 16;
  407. uint8_t* data = malloc(buffer_size);
  408. uint8_t* hash = malloc(sizeof(uint8_t) * hash_size);
  409. md5_context* md5_ctx = malloc(sizeof(md5_context));
  410. md5_starts(md5_ctx);
  411. while(true) {
  412. uint16_t read_size = storage_file_read(file, data, buffer_size);
  413. if(read_size == 0) break;
  414. md5_update(md5_ctx, data, read_size);
  415. }
  416. md5_finish(md5_ctx, hash);
  417. free(md5_ctx);
  418. for(uint8_t i = 0; i < hash_size; i++) {
  419. printf("%02x", hash[i]);
  420. }
  421. printf("\r\n");
  422. free(hash);
  423. free(data);
  424. } else {
  425. storage_cli_print_error(storage_file_get_error(file));
  426. }
  427. storage_file_close(file);
  428. storage_file_free(file);
  429. furi_record_close(RECORD_STORAGE);
  430. }
  431. void storage_cli(Cli* cli, FuriString* args, void* context) {
  432. UNUSED(context);
  433. FuriString* cmd;
  434. FuriString* path;
  435. cmd = furi_string_alloc();
  436. path = furi_string_alloc();
  437. do {
  438. if(!args_read_string_and_trim(args, cmd)) {
  439. storage_cli_print_usage();
  440. break;
  441. }
  442. if(!args_read_probably_quoted_string_and_trim(args, path)) {
  443. storage_cli_print_usage();
  444. break;
  445. }
  446. if(furi_string_cmp_str(cmd, "info") == 0) {
  447. storage_cli_info(cli, path);
  448. break;
  449. }
  450. if(furi_string_cmp_str(cmd, "format") == 0) {
  451. storage_cli_format(cli, path);
  452. break;
  453. }
  454. if(furi_string_cmp_str(cmd, "list") == 0) {
  455. storage_cli_list(cli, path);
  456. break;
  457. }
  458. if(furi_string_cmp_str(cmd, "tree") == 0) {
  459. storage_cli_tree(cli, path);
  460. break;
  461. }
  462. if(furi_string_cmp_str(cmd, "read") == 0) {
  463. storage_cli_read(cli, path);
  464. break;
  465. }
  466. if(furi_string_cmp_str(cmd, "read_chunks") == 0) {
  467. storage_cli_read_chunks(cli, path, args);
  468. break;
  469. }
  470. if(furi_string_cmp_str(cmd, "write") == 0) {
  471. storage_cli_write(cli, path);
  472. break;
  473. }
  474. if(furi_string_cmp_str(cmd, "write_chunk") == 0) {
  475. storage_cli_write_chunk(cli, path, args);
  476. break;
  477. }
  478. if(furi_string_cmp_str(cmd, "copy") == 0) {
  479. storage_cli_copy(cli, path, args);
  480. break;
  481. }
  482. if(furi_string_cmp_str(cmd, "remove") == 0) {
  483. storage_cli_remove(cli, path);
  484. break;
  485. }
  486. if(furi_string_cmp_str(cmd, "rename") == 0) {
  487. storage_cli_rename(cli, path, args);
  488. break;
  489. }
  490. if(furi_string_cmp_str(cmd, "mkdir") == 0) {
  491. storage_cli_mkdir(cli, path);
  492. break;
  493. }
  494. if(furi_string_cmp_str(cmd, "md5") == 0) {
  495. storage_cli_md5(cli, path);
  496. break;
  497. }
  498. if(furi_string_cmp_str(cmd, "stat") == 0) {
  499. storage_cli_stat(cli, path);
  500. break;
  501. }
  502. if(furi_string_cmp_str(cmd, "timestamp") == 0) {
  503. storage_cli_timestamp(cli, path);
  504. break;
  505. }
  506. storage_cli_print_usage();
  507. } while(false);
  508. furi_string_free(path);
  509. furi_string_free(cmd);
  510. }
  511. static void storage_cli_factory_reset(Cli* cli, FuriString* args, void* context) {
  512. UNUSED(args);
  513. UNUSED(context);
  514. printf("All data will be lost! Are you sure (y/n)?\r\n");
  515. char c = cli_getc(cli);
  516. if(c == 'y' || c == 'Y') {
  517. printf("Data will be wiped after reboot.\r\n");
  518. furi_hal_rtc_set_flag(FuriHalRtcFlagFactoryReset);
  519. power_reboot(PowerBootModeNormal);
  520. } else {
  521. printf("Safe choice.\r\n");
  522. }
  523. }
  524. void storage_on_system_start() {
  525. #ifdef SRV_CLI
  526. Cli* cli = furi_record_open(RECORD_CLI);
  527. cli_add_command(cli, RECORD_STORAGE, CliCommandFlagParallelSafe, storage_cli, NULL);
  528. cli_add_command(
  529. cli, "factory_reset", CliCommandFlagParallelSafe, storage_cli_factory_reset, NULL);
  530. furi_record_close(RECORD_CLI);
  531. #else
  532. UNUSED(storage_cli_factory_reset);
  533. #endif
  534. }