summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-06-30 13:31:14 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-06-30 13:31:14 +0000
commita8dab4c08af0e1d251ff633a2859c8b9b24efc7c (patch)
treebe8b66535d905e50319788f988f94ab008a48ba3 /apps
parent058302a4807e14d564195de9825e3aa970ea68f9 (diff)
downloadrockbox-a8dab4c08af0e1d251ff633a2859c8b9b24efc7c.tar.gz
rockbox-a8dab4c08af0e1d251ff633a2859c8b9b24efc7c.zip
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.c13
-rw-r--r--apps/misc.c9
-rw-r--r--apps/misc.h5
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)
1612 return false; 1612 return false;
1613} 1613}
1614 1614
1615#ifdef HAVE_LCD_BITMAP
1616extern bool do_screendump_instead_of_usb;
1617
1618bool dbg_screendump(void)
1619{
1620 do_screendump_instead_of_usb = !do_screendump_instead_of_usb;
1621 splash(HZ, true, "Screendump %s",
1622 do_screendump_instead_of_usb?"enabled":"disabled");
1623 return false;
1624}
1625#endif
1626
1615bool debug_menu(void) 1627bool debug_menu(void)
1616{ 1628{
1617 int m; 1629 int m;
@@ -1635,6 +1647,7 @@ bool debug_menu(void)
1635#endif 1647#endif
1636#ifdef HAVE_LCD_BITMAP 1648#ifdef HAVE_LCD_BITMAP
1637 { "View battery", -1, view_battery }, 1649 { "View battery", -1, view_battery },
1650 { "Screendump", -1, dbg_screendump },
1638#endif 1651#endif
1639 { "View HW info", -1, dbg_hw_info }, 1652 { "View HW info", -1, dbg_hw_info },
1640 { "View partitions", -1, dbg_partitions }, 1653 { "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 @@
23#include "sprintf.h" 23#include "sprintf.h"
24#include "errno.h" 24#include "errno.h"
25#include "system.h" 25#include "system.h"
26#include "timefuncs.h"
26 27
27#define ONE_KILOBYTE 1024 28#define ONE_KILOBYTE 1024
28#define ONE_MEGABYTE (1024*1024) 29#define ONE_MEGABYTE (1024*1024)
@@ -102,7 +103,7 @@ int main(int argc, char **argv)
102 103
103#endif 104#endif
104 105
105#ifdef SCREENDUMP 106#ifdef HAVE_LCD_BITMAP
106extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; 107extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
107static unsigned char bmpheader[] = 108static unsigned char bmpheader[] =
108{ 109{
@@ -117,7 +118,6 @@ static unsigned char bmpheader[] =
117static unsigned char buf[112*8]; 118static unsigned char buf[112*8];
118static unsigned char buf2[112*8]; 119static unsigned char buf2[112*8];
119static char dummy[2] = {0, 0}; 120static char dummy[2] = {0, 0};
120static int fileindex = 0;
121 121
122void screen_dump(void) 122void screen_dump(void)
123{ 123{
@@ -125,6 +125,7 @@ void screen_dump(void)
125 int i, shift; 125 int i, shift;
126 int x, y; 126 int x, y;
127 char filename[MAX_PATH]; 127 char filename[MAX_PATH];
128 struct tm *tm = get_time();
128 129
129 i = 0; 130 i = 0;
130 for(y = 0;y < LCD_HEIGHT/8;y++) 131 for(y = 0;y < LCD_HEIGHT/8;y++)
@@ -151,7 +152,9 @@ void screen_dump(void)
151 } 152 }
152 } 153 }
153 154
154 snprintf(filename, MAX_PATH, "/dump%03d.bmp", fileindex++); 155 snprintf(filename, MAX_PATH, "/dump %04d-%02d-%02d %02d-%02d-%02d.bmp",
156 tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
157 tm->tm_hour, tm->tm_min, tm->tm_sec);
155 f = creat(filename, O_WRONLY); 158 f = creat(filename, O_WRONLY);
156 if(f >= 0) 159 if(f >= 0)
157 { 160 {
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);
30 * stored in buffer. 30 * stored in buffer.
31 */ 31 */
32int read_line(int fd, char* buffer, int buffer_size); 32int read_line(int fd, char* buffer, int buffer_size);
33
34#ifdef HAVE_LCD_BITMAP
35/* Save a .BMP file containing the current screen contents. */
36void screen_dump(void);
37#endif