|
43 | 43 | #include "common-hal/_bleio/__init__.h"
|
44 | 44 |
|
45 | 45 | #include "supervisor/fatfs_port.h"
|
| 46 | +#include "supervisor/filesystem.h" |
46 | 47 | #include "supervisor/shared/reload.h"
|
47 | 48 | #include "supervisor/shared/bluetooth/file_transfer.h"
|
48 | 49 | #include "supervisor/shared/bluetooth/file_transfer_protocol.h"
|
@@ -172,7 +173,7 @@ STATIC uint8_t _process_read(const uint8_t *raw_buf, size_t command_len) {
|
172 | 173 | char *path = (char *)((uint8_t *)command) + header_size;
|
173 | 174 | path[command->path_length] = '\0';
|
174 | 175 |
|
175 |
| - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; |
| 176 | + FATFS *fs = filesystem_circuitpy(); |
176 | 177 | FRESULT result = f_open(fs, &active_file, path, FA_READ);
|
177 | 178 | if (result != FR_OK) {
|
178 | 179 | response.status = STATUS_ERROR;
|
@@ -289,7 +290,7 @@ STATIC uint8_t _process_write(const uint8_t *raw_buf, size_t command_len) {
|
289 | 290 | return ANY_COMMAND;
|
290 | 291 | }
|
291 | 292 |
|
292 |
| - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; |
| 293 | + FATFS *fs = filesystem_circuitpy(); |
293 | 294 | DWORD fattime;
|
294 | 295 | _truncated_time = truncate_time(command->modification_time, &fattime);
|
295 | 296 | override_fattime(fattime);
|
@@ -438,7 +439,7 @@ STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) {
|
438 | 439 | if (command_len < header_size + command->path_length) {
|
439 | 440 | return THIS_COMMAND;
|
440 | 441 | }
|
441 |
| - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; |
| 442 | + FATFS *fs = filesystem_circuitpy(); |
442 | 443 | char *path = (char *)((uint8_t *)command) + header_size;
|
443 | 444 | path[command->path_length] = '\0';
|
444 | 445 | FILINFO file;
|
@@ -495,7 +496,7 @@ STATIC uint8_t _process_mkdir(const uint8_t *raw_buf, size_t command_len) {
|
495 | 496 | if (command_len < header_size + command->path_length) {
|
496 | 497 | return THIS_COMMAND;
|
497 | 498 | }
|
498 |
| - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; |
| 499 | + FATFS *fs = filesystem_circuitpy(); |
499 | 500 | char *path = (char *)command->path;
|
500 | 501 | _terminate_path(path, command->path_length);
|
501 | 502 |
|
@@ -552,7 +553,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
|
552 | 553 | return THIS_COMMAND;
|
553 | 554 | }
|
554 | 555 |
|
555 |
| - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; |
| 556 | + FATFS *fs = filesystem_circuitpy(); |
556 | 557 | char *path = (char *)&command->path;
|
557 | 558 | _terminate_path(path, command->path_length);
|
558 | 559 | // mp_printf(&mp_plat_print, "list %s\n", path);
|
@@ -640,7 +641,7 @@ STATIC uint8_t _process_move(const uint8_t *raw_buf, size_t command_len) {
|
640 | 641 | if (command_len < header_size + total_path_length) {
|
641 | 642 | return THIS_COMMAND;
|
642 | 643 | }
|
643 |
| - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; |
| 644 | + FATFS *fs = filesystem_circuitpy(); |
644 | 645 | char *old_path = (char *)command->paths;
|
645 | 646 | old_path[command->old_path_length] = '\0';
|
646 | 647 |
|
|
0 commit comments