Added logfdump - that writes the internal logf log to .rockbox/logf.txt
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6545 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e6910760b1
commit
c95319f6fd
4 changed files with 41 additions and 0 deletions
|
@ -2050,6 +2050,7 @@ bool debug_menu(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef ROCKBOX_HAS_LOGF
|
#ifdef ROCKBOX_HAS_LOGF
|
||||||
{"logf", logfdisplay },
|
{"logf", logfdisplay },
|
||||||
|
{"logfdump", logfdump },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef ROCKBOX_HAS_LOGF
|
#ifdef ROCKBOX_HAS_LOGF
|
||||||
|
#include <file.h>
|
||||||
|
#include <sprintf.h>
|
||||||
#include <timefuncs.h>
|
#include <timefuncs.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
|
@ -85,4 +87,40 @@ bool logfdisplay(void)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#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 */
|
#endif /* ROCKBOX_HAS_LOGF */
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#ifndef LOGFDISP_H
|
#ifndef LOGFDISP_H
|
||||||
#define LOGFDISP_H
|
#define LOGFDISP_H
|
||||||
bool logfdisplay(void);
|
bool logfdisplay(void);
|
||||||
|
bool logfdump(void);
|
||||||
|
|
||||||
#endif /* LOGFDISP_H */
|
#endif /* LOGFDISP_H */
|
||||||
|
|
||||||
|
|
|
@ -351,6 +351,7 @@ bool info_menu(void)
|
||||||
{ ID2P(LANG_USB), simulate_usb },
|
{ ID2P(LANG_USB), simulate_usb },
|
||||||
#ifdef ROCKBOX_HAS_LOGF
|
#ifdef ROCKBOX_HAS_LOGF
|
||||||
{"logf", logfdisplay },
|
{"logf", logfdisplay },
|
||||||
|
{"logfdump", logfdump },
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue