diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-30 13:31:14 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-30 13:31:14 +0000 |
commit | a8dab4c08af0e1d251ff633a2859c8b9b24efc7c (patch) | |
tree | be8b66535d905e50319788f988f94ab008a48ba3 /apps | |
parent | 058302a4807e14d564195de9825e3aa970ea68f9 (diff) |
New screen dump feature for recorders
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4817 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/debug_menu.c | 13 | ||||
-rw-r--r-- | apps/misc.c | 9 | ||||
-rw-r--r-- | apps/misc.h | 5 |
3 files changed, 24 insertions, 3 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 02b86feefc..0b4be9d72d 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -1612,6 +1612,18 @@ static bool dbg_sound(void) return false; } +#ifdef HAVE_LCD_BITMAP +extern bool do_screendump_instead_of_usb; + +bool dbg_screendump(void) +{ + do_screendump_instead_of_usb = !do_screendump_instead_of_usb; + splash(HZ, true, "Screendump %s", + do_screendump_instead_of_usb?"enabled":"disabled"); + return false; +} +#endif + bool debug_menu(void) { int m; @@ -1635,6 +1647,7 @@ bool debug_menu(void) #endif #ifdef HAVE_LCD_BITMAP { "View battery", -1, view_battery }, + { "Screendump", -1, dbg_screendump }, #endif { "View HW info", -1, dbg_hw_info }, { "View partitions", -1, dbg_partitions }, diff --git a/apps/misc.c b/apps/misc.c index be1c3202fb..701f766a8d 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -23,6 +23,7 @@ #include "sprintf.h" #include "errno.h" #include "system.h" +#include "timefuncs.h" #define ONE_KILOBYTE 1024 #define ONE_MEGABYTE (1024*1024) @@ -102,7 +103,7 @@ int main(int argc, char **argv) #endif -#ifdef SCREENDUMP +#ifdef HAVE_LCD_BITMAP extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; static unsigned char bmpheader[] = { @@ -117,7 +118,6 @@ static unsigned char bmpheader[] = static unsigned char buf[112*8]; static unsigned char buf2[112*8]; static char dummy[2] = {0, 0}; -static int fileindex = 0; void screen_dump(void) { @@ -125,6 +125,7 @@ void screen_dump(void) int i, shift; int x, y; char filename[MAX_PATH]; + struct tm *tm = get_time(); i = 0; for(y = 0;y < LCD_HEIGHT/8;y++) @@ -151,7 +152,9 @@ void screen_dump(void) } } - snprintf(filename, MAX_PATH, "/dump%03d.bmp", fileindex++); + snprintf(filename, MAX_PATH, "/dump %04d-%02d-%02d %02d-%02d-%02d.bmp", + tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); f = creat(filename, O_WRONLY); if(f >= 0) { diff --git a/apps/misc.h b/apps/misc.h index c8aa266d5f..329c62750c 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -30,3 +30,8 @@ char *num2max5(unsigned int bytes, char *max5); * stored in buffer. */ int read_line(int fd, char* buffer, int buffer_size); + +#ifdef HAVE_LCD_BITMAP +/* Save a .BMP file containing the current screen contents. */ +void screen_dump(void); +#endif |