summaryrefslogtreecommitdiff
path: root/avr/cmd_fat.c
diff options
context:
space:
mode:
authorLeo C2018-08-31 23:36:06 +0200
committerLeo C2018-08-31 23:36:06 +0200
commit414caa77d5709bf3372d1f9245312781eee7961b (patch)
treef2a6db4c2723cafed364bf73cf48f28c6666f86b /avr/cmd_fat.c
parent85d34e1026065c340e2237e1d2ab56e868be86ec (diff)
downloadz180-stamp-414caa77d5709bf3372d1f9245312781eee7961b.zip
error handling: improved cmd_error() - print fatfs error strings
Diffstat (limited to 'avr/cmd_fat.c')
-rw-r--r--avr/cmd_fat.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/avr/cmd_fat.c b/avr/cmd_fat.c
index ab16fa5..7cc9e46 100644
--- a/avr/cmd_fat.c
+++ b/avr/cmd_fat.c
@@ -76,26 +76,26 @@ static bool check_abort(void)
static const FLASH char * const FLASH rc_strings[] = {
- FSTR("OK"),
- FSTR("disk error"),
- FSTR("internal error"),
- FSTR("not ready"),
- FSTR("no file"),
- FSTR("no path"),
- FSTR("invalid name"),
- FSTR("denied"),
- FSTR("exist"),
- FSTR("invalid object"),
- FSTR("write protected"),
- FSTR("invalid drive"),
- FSTR("not enabled"),
- FSTR("no file system"),
- FSTR("mkfs aborted"),
- FSTR("timeout"),
- FSTR("locked"),
- FSTR("not enough core"),
- FSTR("too many open files"),
- FSTR("invalid parameter")
+ FSTR("Success"),
+ FSTR("Disk error"),
+ FSTR("Internal error"),
+ FSTR("Not ready"),
+ FSTR("No file"),
+ FSTR("No path"),
+ FSTR("Invalid name"),
+ FSTR("Denied"),
+ FSTR("Exist"),
+ FSTR("Invalid object"),
+ FSTR("Write protected"),
+ FSTR("Invalid drive"),
+ FSTR("Not enabled"),
+ FSTR("No file system"),
+ FSTR("Mkfs aborted"),
+ FSTR("Timeout"),
+ FSTR("Locked"),
+ FSTR("Not enough core"),
+ FSTR("Too many open files"),
+ FSTR("Invalid parameter")
};
static const FLASH char * const FLASH rc_names[] = {
@@ -135,7 +135,7 @@ void put_rc (FRESULT rc)
}
-const FLASH char * rctostr(FRESULT rc)
+const FLASH char * fat_rctostr(FRESULT rc)
{
return rc < ARRAY_SIZE(rc_strings) ? rc_strings[rc] : PSTR(" Unknown Error");
}
@@ -198,13 +198,13 @@ static void strip_trailing_slash(PATH_T *p)
static PATH_T *path_setup(char *string)
{
if (strlen(string) > PATH_MAX) {
- cmd_error(PSTR("'%s': name too long"), string);
+ cmd_error(0, 0, PSTR("'%s': Name too long"), string);
return NULL;
}
PATH_T *p = (PATH_T *) malloc(sizeof *p);
if (p == NULL) {
- cmd_error(PSTR("'%s': Out of Memory"), string);
+ cmd_error(0, 0, PSTR("'%s': Out of Memory"), string);
return NULL;
}
@@ -216,7 +216,7 @@ static PATH_T *path_setup(char *string)
p->p_path[2] = '/';
len += 1;
} else {
- cmd_error(PSTR("'%s': Out of Memory"), string);
+ cmd_error(0, 0, PSTR("'%s': Out of Memory"), string);
return NULL;
}
}
@@ -255,8 +255,9 @@ command_ret_t do_pwd(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc
}
free(buf);
if (res != FR_OK) {
- put_rc(res);
- return CMD_RET_FAILURE;
+ cmd_error(CMD_RET_FAILURE, res, NULL);
+ //put_rc(res);
+ //return CMD_RET_FAILURE;
}
return CMD_RET_SUCCESS;
}