From c734de490a03927dfb244224aec90d333606a3ef Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 10 Apr 2016 16:53:28 +0300 Subject: [PATCH] esp8266/main: mp_builtin_open(): Implement, using vfs_proxy_call(). --- esp8266/main.c | 6 ++++++ esp8266/moduos.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/esp8266/main.c b/esp8266/main.c index bbd0b4dfd8..08085299ba 100644 --- a/esp8266/main.c +++ b/esp8266/main.c @@ -123,8 +123,14 @@ mp_import_stat_t mp_import_stat(const char *path) { #endif } +mp_obj_t vfs_proxy_call(qstr method_name, mp_uint_t n_args, const mp_obj_t *args); mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) { + #if MICROPY_VFS_FAT + // TODO: Handle kwargs! + return vfs_proxy_call(MP_QSTR_open, n_args, args); + #else return mp_const_none; + #endif } MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); diff --git a/esp8266/moduos.c b/esp8266/moduos.c index 6633f5a764..8b9c177db0 100644 --- a/esp8266/moduos.c +++ b/esp8266/moduos.c @@ -72,7 +72,7 @@ STATIC mp_obj_t os_uname(void) { STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); #if MICROPY_VFS_FAT -STATIC mp_obj_t vfs_proxy_call(qstr method_name, mp_uint_t n_args, const mp_obj_t *args) { +mp_obj_t vfs_proxy_call(qstr method_name, mp_uint_t n_args, const mp_obj_t *args) { if (MP_STATE_PORT(fs_user_mount)[0] == NULL) { nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENODEV))); }