From 6d2df9bf9400acd6716a2a3c0b5c02f7973cc43c Mon Sep 17 00:00:00 2001 From: Grissiom Date: Sun, 22 Sep 2013 22:12:04 +0800 Subject: finsh: unregister rx_indicate when closing the device Because the device could still remain opened when closed by finsh, the old rx_indicate is useless for finsh. Some buggy driver will still generate rx_indicate even after the device has been closed. So FinSh should unregister the rx_indicate when releasing the old device. --- components/finsh/shell.c | 1 + 1 file changed, 1 insertion(+) (limited to 'components') diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 19dd93691e..8ff0e89e44 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -131,6 +131,7 @@ void finsh_set_device(const char* device_name) { /* close old finsh device */ rt_device_close(shell->device); + rt_device_set_rx_indicate(dev, RT_NULL); } shell->device = dev; -- cgit v1.3.1 From 783a6a67176e5594bed0cbba82cb9f0ef70e3863 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Mon, 23 Sep 2013 13:13:03 +0800 Subject: logtrace: cleanup code and fix compiling warnings --- components/utilities/logtrace/log_trace.c | 4 ++-- components/utilities/logtrace/log_trace.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'components') diff --git a/components/utilities/logtrace/log_trace.c b/components/utilities/logtrace/log_trace.c index 79d5a21884..cc55b1dd44 100644 --- a/components/utilities/logtrace/log_trace.c +++ b/components/utilities/logtrace/log_trace.c @@ -41,7 +41,7 @@ static struct rt_device _log_device; static rt_device_t _traceout_device = RT_NULL; /* define a default lg session. The name is empty. */ -static struct log_trace_session _def_session = {{0}, LOG_TRACE_LEVEL_INFO}; +static struct log_trace_session _def_session = {{"\0"}, LOG_TRACE_LEVEL_INFO}; static struct log_trace_session *_the_sessions[LOG_TRACE_MAX_SESSION] = {&_def_session}; /* there is a default session at least */ static rt_uint16_t _the_sess_nr = 1; @@ -272,7 +272,7 @@ static void _lg_fmtout( _trace_buf[0] = ']'; ptr = &_trace_buf[1]; - length = vsnprintf(ptr, LOG_TRACE_BUFSZ, fmt, argptr); + length = rt_vsnprintf(ptr, LOG_TRACE_BUFSZ, fmt, argptr); if (length >= LOG_TRACE_BUFSZ) length = LOG_TRACE_BUFSZ - 1; diff --git a/components/utilities/logtrace/log_trace.h b/components/utilities/logtrace/log_trace.h index d5a028f553..42240858fb 100644 --- a/components/utilities/logtrace/log_trace.h +++ b/components/utilities/logtrace/log_trace.h @@ -140,12 +140,12 @@ rt_err_t log_trace_set_device(const char *device_name); void log_trace_flush(void); +#ifdef RT_USING_DFS /** set the backend to file */ void log_trace_set_file(const char *filename); -/* log trace for NAND Flash */ -void log_trace_nand_init(const char *nand_device); void log_trace_file_init(const char *filename); +#endif /* RT_USING_DFS */ #endif -- cgit v1.3.1 From 519982fa7411a71d1494855e945196c33c793aee Mon Sep 17 00:00:00 2001 From: Grissiom Date: Mon, 23 Sep 2013 15:10:02 +0800 Subject: logtrace: add LOG_TRACE_VERBOSE log level --- components/utilities/logtrace/log_trace.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'components') diff --git a/components/utilities/logtrace/log_trace.h b/components/utilities/logtrace/log_trace.h index 42240858fb..68442dd2f8 100644 --- a/components/utilities/logtrace/log_trace.h +++ b/components/utilities/logtrace/log_trace.h @@ -33,7 +33,8 @@ #define LOG_TRACE_LEVEL_ERROR 0x01 #define LOG_TRACE_LEVEL_WARNING 0x02 #define LOG_TRACE_LEVEL_INFO 0x03 -#define LOG_TRACE_LEVEL_DEBUG 0x04 +#define LOG_TRACE_LEVEL_VERBOSE 0x04 +#define LOG_TRACE_LEVEL_DEBUG 0x05 #define LOG_TRACE_LEVEL_ALL 0x0f #ifndef LOG_TRACE_LEVEL_DEFAULT @@ -43,7 +44,8 @@ #define LOG_TRACE_ERROR "<1>" #define LOG_TRACE_WARNING "<2>" #define LOG_TRACE_INFO "<3>" -#define LOG_TRACE_DEBUG "<4>" +#define LOG_TRACE_VERBOSE "<4>" +#define LOG_TRACE_DEBUG "<5>" #define LOG_TRACE_OPT_NOTS 0x10 /* no timestamp */ #define LOG_TRACE_OPT_LN 0x20 /* terminate the current line */ -- cgit v1.3.1 From 2a203377073573ac1a3191fc6cc8f71e308ab123 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Mon, 23 Sep 2013 15:13:45 +0800 Subject: logtrace: adjust the log values logtrace only use odd number of log levels. So the use could set some custom level amount them. --- components/utilities/logtrace/log_trace.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'components') diff --git a/components/utilities/logtrace/log_trace.h b/components/utilities/logtrace/log_trace.h index 68442dd2f8..77e1f08b6c 100644 --- a/components/utilities/logtrace/log_trace.h +++ b/components/utilities/logtrace/log_trace.h @@ -31,10 +31,10 @@ #define LOG_TRACE_LEVEL_MASK 0x0f #define LOG_TRACE_LEVEL_NOTRACE 0x00 #define LOG_TRACE_LEVEL_ERROR 0x01 -#define LOG_TRACE_LEVEL_WARNING 0x02 -#define LOG_TRACE_LEVEL_INFO 0x03 -#define LOG_TRACE_LEVEL_VERBOSE 0x04 -#define LOG_TRACE_LEVEL_DEBUG 0x05 +#define LOG_TRACE_LEVEL_WARNING 0x03 +#define LOG_TRACE_LEVEL_INFO 0x05 +#define LOG_TRACE_LEVEL_VERBOSE 0x07 +#define LOG_TRACE_LEVEL_DEBUG 0x09 #define LOG_TRACE_LEVEL_ALL 0x0f #ifndef LOG_TRACE_LEVEL_DEFAULT @@ -42,10 +42,10 @@ #endif #define LOG_TRACE_ERROR "<1>" -#define LOG_TRACE_WARNING "<2>" -#define LOG_TRACE_INFO "<3>" -#define LOG_TRACE_VERBOSE "<4>" -#define LOG_TRACE_DEBUG "<5>" +#define LOG_TRACE_WARNING "<3>" +#define LOG_TRACE_INFO "<5>" +#define LOG_TRACE_VERBOSE "<7>" +#define LOG_TRACE_DEBUG "<9>" #define LOG_TRACE_OPT_NOTS 0x10 /* no timestamp */ #define LOG_TRACE_OPT_LN 0x20 /* terminate the current line */ -- cgit v1.3.1 From 05651e7c662139a1d56c6ee0d859ae190346b314 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Thu, 26 Sep 2013 11:49:33 +0800 Subject: logtrace: only export cmd when finsh is enabled --- components/utilities/logtrace/log_file.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'components') diff --git a/components/utilities/logtrace/log_file.c b/components/utilities/logtrace/log_file.c index 72e4724b63..2f4a28b63c 100644 --- a/components/utilities/logtrace/log_file.c +++ b/components/utilities/logtrace/log_file.c @@ -121,6 +121,9 @@ void log_trace_set_file(const char *filename) log_trace_file_init(filename); log_trace_set_device("logfile"); } +#ifdef RT_USING_FINSH +#include FINSH_FUNCTION_EXPORT_ALIAS(log_trace_set_file, log_file, set output filename of log trace); +#endif #endif /* RT_USING_DFS */ -- cgit v1.3.1 From df4e8ff060fc2d3f6092df0e9ba75ffba0650a1e Mon Sep 17 00:00:00 2001 From: Grissiom Date: Thu, 26 Sep 2013 11:50:28 +0800 Subject: msh: only export cd/pwd when DFS_USING_WORKDIR is set --- components/finsh/msh_cmd.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'components') diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c index fac90479c8..cffb374c2e 100644 --- a/components/finsh/msh_cmd.c +++ b/components/finsh/msh_cmd.c @@ -136,6 +136,7 @@ int cmd_rm(int argc, char** argv) } FINSH_FUNCTION_EXPORT_ALIAS(cmd_rm, __cmd_rm, "Remove (unlink) the FILE(s)."); +#ifdef DFS_USING_WORKDIR int cmd_cd(int argc, char** argv) { if (argc == 1) @@ -157,6 +158,7 @@ int cmd_pwd(int argc, char** argv) return 0; } FINSH_FUNCTION_EXPORT_ALIAS(cmd_pwd, __cmd_pwd, Print the name of the current working directory.); +#endif int cmd_mkdir(int argc, char** argv) { -- cgit v1.3.1 From 12a636621771a838f808acd25758dd061a686993 Mon Sep 17 00:00:00 2001 From: prife Date: Sat, 28 Sep 2013 14:43:00 +0800 Subject: DFS/jffs2: fix file mode init bug in jffs2_open/opendir found by haitao52198 URL:http://www.rt-thread.org/phpBB3/viewtopic.php?f=3&t=3112&p=17153#p17153 --- components/dfs/filesystems/jffs2/src/fs-ecos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'components') diff --git a/components/dfs/filesystems/jffs2/src/fs-ecos.c b/components/dfs/filesystems/jffs2/src/fs-ecos.c index 5f3b5d607c..814d2e3010 100644 --- a/components/dfs/filesystems/jffs2/src/fs-ecos.c +++ b/components/dfs/filesystems/jffs2/src/fs-ecos.c @@ -747,7 +747,7 @@ int jffs2_open(cyg_mtab_entry * mte, cyg_dir dir, const char *name, } // Initialise the file object - file->f_flag |= mode & CYG_FILE_MODE_MASK; + file->f_flag = mode & CYG_FILE_MODE_MASK; file->f_type = CYG_FILE_TYPE_FILE; file->f_ops = &jffs2_fileops; file->f_offset = (mode & O_APPEND) ? node->i_size : 0; @@ -1065,6 +1065,7 @@ static int jffs2_opendir(cyg_mtab_entry * mte, cyg_dir dir, const char *name, // Initialize the file object, setting the f_ops field to a // special set of file ops. + file->f_flag = 0; file->f_type = CYG_FILE_TYPE_FILE; file->f_ops = &jffs2_dirops; file->f_offset = 0; -- cgit v1.3.1 From f71f0595d68b42709f93c524a9d2ad4a85c75489 Mon Sep 17 00:00:00 2001 From: prife Date: Sat, 28 Sep 2013 14:57:05 +0800 Subject: DFS/jffs2: fix bug when umount jffs2 found by haitao5198 clear mount parition device talbe when jffs2 mount falied --- components/dfs/filesystems/jffs2/dfs_jffs2.c | 1 + 1 file changed, 1 insertion(+) (limited to 'components') diff --git a/components/dfs/filesystems/jffs2/dfs_jffs2.c b/components/dfs/filesystems/jffs2/dfs_jffs2.c index 3b96295c76..6516797544 100644 --- a/components/dfs/filesystems/jffs2/dfs_jffs2.c +++ b/components/dfs/filesystems/jffs2/dfs_jffs2.c @@ -178,6 +178,7 @@ static int dfs_jffs2_mount(struct dfs_filesystem* fs, result = jffs2_mount(NULL, mte); if (result != 0) { + device_partition[index].dev = NULL; return jffs2_result_to_dfs(result); } /* save this pointer */ -- cgit v1.3.1