add filesystem command stubs

This commit is contained in:
Aurel Feer 2022-06-01 23:04:03 +02:00
parent 8e0c0c13ed
commit 5379df28a8
3 changed files with 58 additions and 1 deletions

View File

@ -14,6 +14,6 @@
{
target = "shelly",
cFiles = [ "shelly.c" ],
addLibraries = [ "lpuart", "gic_dist" ]
addLibraries = [ "lpuart", "gic_dist", "fs" ]
}
]

View File

@ -16,6 +16,7 @@
#include <aos/ump_chan.h>
#include <aos/shelly_client.h>
#include <aos/aos_rpc.h>
#include <fs/fs.h>
#include "shelly.h"
@ -274,6 +275,11 @@ int main(int argc, char *argv[])
SHELLY_DEBUG("registered as shelly server\n");
// err = filesystem_init();
// if (err_is_fail(err)) DEBUG_ERR(err, "Failed to init filesystem");
// SHELLY_DEBUG("initialized filesystem\n");
err = shelly_write_str("Welcome to Shelly(TM)(TM)!\n\r");
if (err_is_fail(err)) USER_PANIC_ERR(err, "while trying to write welcome message");

View File

@ -24,12 +24,55 @@ static errval_t shelly_cmd_help(char * line) {
if (err_is_fail(err)) return err;
err = shelly_write_str("- ps\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- ls\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- cat\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str(" ...meow\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- mkdir\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- rmdir\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("- help\n\r");
if (err_is_fail(err)) return err;
return SYS_ERR_OK;
}
static errval_t shelly_cmd_ls(char * line) {
// errval_t err;
return SYS_ERR_OK;
}
static errval_t shelly_cmd_cat(char * line) {
errval_t err;
err = shelly_write_str(" /\\_/\\ ___\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str(" = o_o =_______ \\ \\\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str(" __^ __( \\.__) )\n\r");
if (err_is_fail(err)) return err;
err = shelly_write_str("(@)<_____>__(_____)____/\n\r");
if (err_is_fail(err)) return err;
return SYS_ERR_OK;
}
static errval_t shelly_cmd_mkdir(char * line) {
// errval_t err;
return SYS_ERR_OK;
}
static errval_t shelly_cmd_rmdir(char * line) {
// errval_t err;
return SYS_ERR_OK;
}
static errval_t shelly_cmd_echo(char * line) {
errval_t err;
err = shelly_write_str(line);
@ -98,6 +141,14 @@ static errval_t handle_shelly_cmd(char* line, size_t len) {
return shelly_cmd_ps(remaining_line);
} else if (strcmp(cmd, "help") == 0) {
return shelly_cmd_help(remaining_line);
} else if (strcmp(cmd, "ls") == 0) {
return shelly_cmd_ls(remaining_line);
} else if (strcmp(cmd, "cat") == 0) {
return shelly_cmd_cat(remaining_line);
} else if (strcmp(cmd, "mkdir") == 0) {
return shelly_cmd_mkdir(remaining_line);
} else if (strcmp(cmd, "rmdir") == 0) {
return shelly_cmd_rmdir(remaining_line);
} else {
char buf[256];
snprintf(buf, 256, "unknown command \"%s\"\n\r", cmd);