summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c1
-rw-r--r--apps/logfdisp.c38
-rw-r--r--apps/logfdisp.h1
-rw-r--r--apps/main_menu.c1
4 files changed, 41 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 5f4e67f537..b861e80ad6 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -2050,6 +2050,7 @@ bool debug_menu(void)
#endif
#ifdef ROCKBOX_HAS_LOGF
{"logf", logfdisplay },
+ {"logfdump", logfdump },
#endif
};
diff --git a/apps/logfdisp.c b/apps/logfdisp.c
index 36c4997aa8..e3aa29fb76 100644
--- a/apps/logfdisp.c
+++ b/apps/logfdisp.c
@@ -19,6 +19,8 @@
#include "config.h"
#ifdef ROCKBOX_HAS_LOGF
+#include <file.h>
+#include <sprintf.h>
#include <timefuncs.h>
#include <string.h>
#include <kernel.h>
@@ -85,4 +87,40 @@ bool logfdisplay(void)
}
#endif /* HAVE_LCD_BITMAP */
+/* Store the logf log to logf.txt in the .rockbox directory. The order of the
+ * entries will be "reversed" so that the most recently logged entry is on the
+ * top of the file */
+bool logfdump(void)
+{
+ int fd;
+
+ if(!logfindex && !logfwrap)
+ /* nothing is logged just yet */
+ return false;
+
+ fd = open("/.rockbox/logf.txt", O_CREAT|O_WRONLY);
+ if(-1 != fd) {
+ unsigned char buffer[17];
+ int index = logfindex-1;
+ int stop = logfindex;
+
+
+ while(index != stop) {
+ if(index < 0) {
+ if(logfwrap)
+ index = MAX_LOGF_LINES-1;
+ else
+ break; /* done */
+ }
+
+ memcpy(buffer, logfbuffer[index], 16);
+ buffer[16]=0;
+ fdprintf(fd, "%s\n", buffer);
+ index--;
+ }
+ close(fd);
+ }
+ return false;
+}
+
#endif /* ROCKBOX_HAS_LOGF */
diff --git a/apps/logfdisp.h b/apps/logfdisp.h
index 1b0d8c9ddb..1bbac29272 100644
--- a/apps/logfdisp.h
+++ b/apps/logfdisp.h
@@ -19,6 +19,7 @@
#ifndef LOGFDISP_H
#define LOGFDISP_H
bool logfdisplay(void);
+bool logfdump(void);
#endif /* LOGFDISP_H */
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 44321142c8..020f5d608c 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -351,6 +351,7 @@ bool info_menu(void)
{ ID2P(LANG_USB), simulate_usb },
#ifdef ROCKBOX_HAS_LOGF
{"logf", logfdisplay },
+ {"logfdump", logfdump },
#endif
#endif
};