Browse Source

[smart] Disable sys log in default

bernard 4 years ago
parent
commit
4f20921e60
2 changed files with 18 additions and 16 deletions
  1. 0 15
      bsp/qemu-vexpress-a9/drivers/automac.h
  2. 18 1
      components/lwp/lwp_syscall.c

+ 0 - 15
bsp/qemu-vexpress-a9/drivers/automac.h

@@ -1,15 +0,0 @@
-
-#ifndef __MAC_AUTO_GENERATE_H__
-#define __MAC_AUTO_GENERATE_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* mac configure file for RT-Thread qemu */
-
-#define AUTOMAC0  0x52
-#define AUTOMAC1  0x54
-#define AUTOMAC2  0x00
-#define AUTOMAC3  0x28
-#define AUTOMAC4  0xae
-#define AUTOMAC5  0xeb
-
-#endif

+ 18 - 1
components/lwp/lwp_syscall.c

@@ -813,11 +813,28 @@ void sys_exit_critical(void)
 }
 
 /* syscall: "sys_log" ret: "int" args: "const char*" "size" */
+static int __sys_log_enable = 0;
+static int sys_log_enable(int argc, char** argv)
+{
+    if (argc == 1)
+    {
+        rt_kprintf("sys_log = %d\n", __sys_log_enable);
+        return 0;
+    }
+    else
+    {
+        __sys_log_enable = atoi(argv[1]);
+    }
+
+    return 0;
+}
+MSH_CMD_EXPORT_ALIAS(sys_log_enable, sys_log, sys_log 1(enable)/0(disable));
+
 int sys_log(const char* log, int size)
 {
     rt_device_t console = rt_console_get_device();
 
-    if (console) rt_device_write(console, -1, log, size);
+    if (console && __sys_log_enable) rt_device_write(console, -1, log, size);
 
     return 0;
 }