mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
New screen dump feature for recorders
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4817 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
058302a480
commit
a8dab4c08a
7 changed files with 89 additions and 76 deletions
|
@ -1612,6 +1612,18 @@ static bool dbg_sound(void)
|
||||||
return false;
|
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)
|
bool debug_menu(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
@ -1635,6 +1647,7 @@ bool debug_menu(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{ "View battery", -1, view_battery },
|
{ "View battery", -1, view_battery },
|
||||||
|
{ "Screendump", -1, dbg_screendump },
|
||||||
#endif
|
#endif
|
||||||
{ "View HW info", -1, dbg_hw_info },
|
{ "View HW info", -1, dbg_hw_info },
|
||||||
{ "View partitions", -1, dbg_partitions },
|
{ "View partitions", -1, dbg_partitions },
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "errno.h"
|
#include "errno.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
#include "timefuncs.h"
|
||||||
|
|
||||||
#define ONE_KILOBYTE 1024
|
#define ONE_KILOBYTE 1024
|
||||||
#define ONE_MEGABYTE (1024*1024)
|
#define ONE_MEGABYTE (1024*1024)
|
||||||
|
@ -102,7 +103,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SCREENDUMP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
|
extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
|
||||||
static unsigned char bmpheader[] =
|
static unsigned char bmpheader[] =
|
||||||
{
|
{
|
||||||
|
@ -117,7 +118,6 @@ static unsigned char bmpheader[] =
|
||||||
static unsigned char buf[112*8];
|
static unsigned char buf[112*8];
|
||||||
static unsigned char buf2[112*8];
|
static unsigned char buf2[112*8];
|
||||||
static char dummy[2] = {0, 0};
|
static char dummy[2] = {0, 0};
|
||||||
static int fileindex = 0;
|
|
||||||
|
|
||||||
void screen_dump(void)
|
void screen_dump(void)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +125,7 @@ void screen_dump(void)
|
||||||
int i, shift;
|
int i, shift;
|
||||||
int x, y;
|
int x, y;
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
|
struct tm *tm = get_time();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for(y = 0;y < LCD_HEIGHT/8;y++)
|
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);
|
f = creat(filename, O_WRONLY);
|
||||||
if(f >= 0)
|
if(f >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,3 +30,8 @@ char *num2max5(unsigned int bytes, char *max5);
|
||||||
* stored in buffer.
|
* stored in buffer.
|
||||||
*/
|
*/
|
||||||
int read_line(int fd, char* buffer, int buffer_size);
|
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
|
||||||
|
|
|
@ -35,12 +35,6 @@
|
||||||
#define VOLUP 0xD0
|
#define VOLUP 0xD0
|
||||||
#define VOLDN 0xE0
|
#define VOLDN 0xE0
|
||||||
|
|
||||||
#ifdef SCREENDUMP
|
|
||||||
#define SCRDMP 0xF0
|
|
||||||
|
|
||||||
static void screen_dump(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void serial_setup (void)
|
void serial_setup (void)
|
||||||
{
|
{
|
||||||
/* Set PB10 function to serial Rx */
|
/* Set PB10 function to serial Rx */
|
||||||
|
@ -118,11 +112,6 @@ int remote_control_rx(void)
|
||||||
last_valid_button = BUTTON_RC_RIGHT;
|
last_valid_button = BUTTON_RC_RIGHT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef SCREENDUMP
|
|
||||||
case SCRDMP:
|
|
||||||
screen_dump();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
last_valid_button = BUTTON_NONE;
|
last_valid_button = BUTTON_NONE;
|
||||||
break;
|
break;
|
||||||
|
@ -144,43 +133,3 @@ int remote_control_rx(void)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SCREENDUMP
|
|
||||||
static void serial_enable_tx(void)
|
|
||||||
{
|
|
||||||
SCR1 |= 0x20;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void serial_tx(unsigned char ch)
|
|
||||||
{
|
|
||||||
while (!(SSR1 & SCI_TDRE))
|
|
||||||
{
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Write data into TDR and clear TDRE
|
|
||||||
*/
|
|
||||||
TDR1 = ch;
|
|
||||||
SSR1 &= ~SCI_TDRE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void screen_dump(void)
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
int level;
|
|
||||||
|
|
||||||
serial_enable_tx();
|
|
||||||
|
|
||||||
level = set_irq_level(HIGHEST_IRQ_LEVEL);
|
|
||||||
for(y = 0;y < LCD_HEIGHT/8;y++)
|
|
||||||
{
|
|
||||||
for(x = 0;x < LCD_WIDTH;x++)
|
|
||||||
{
|
|
||||||
serial_tx(lcd_framebuffer[y][x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set_irq_level(level);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
|
|
||||||
extern void dbg_ports(void); /* NASTY! defined in apps/ */
|
extern void dbg_ports(void); /* NASTY! defined in apps/ */
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
bool do_screendump_instead_of_usb = false;
|
||||||
|
void screen_dump(void); /* Nasty again. Defined in apps/ too */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define USB_REALLY_BRAVE
|
#define USB_REALLY_BRAVE
|
||||||
|
|
||||||
#if !defined(SIMULATOR) && !defined(USB_NONE)
|
#if !defined(SIMULATOR) && !defined(USB_NONE)
|
||||||
|
@ -149,6 +154,14 @@ static void usb_thread(void)
|
||||||
switch(ev.id)
|
switch(ev.id)
|
||||||
{
|
{
|
||||||
case USB_INSERTED:
|
case USB_INSERTED:
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
if(do_screendump_instead_of_usb)
|
||||||
|
{
|
||||||
|
screen_dump();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#endif
|
||||||
/* Tell all threads that they have to back off the ATA.
|
/* Tell all threads that they have to back off the ATA.
|
||||||
We subtract one for our own thread. */
|
We subtract one for our own thread. */
|
||||||
num_acks_to_expect =
|
num_acks_to_expect =
|
||||||
|
@ -156,6 +169,9 @@ static void usb_thread(void)
|
||||||
waiting_for_ack = true;
|
waiting_for_ack = true;
|
||||||
DEBUGF("USB inserted. Waiting for ack from %d threads...\n",
|
DEBUGF("USB inserted. Waiting for ack from %d threads...\n",
|
||||||
num_acks_to_expect);
|
num_acks_to_expect);
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SYS_USB_CONNECTED_ACK:
|
case SYS_USB_CONNECTED_ACK:
|
||||||
|
@ -181,6 +197,10 @@ static void usb_thread(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USB_EXTRACTED:
|
case USB_EXTRACTED:
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
if(!do_screendump_instead_of_usb)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
if(usb_state == USB_INSERTED)
|
if(usb_state == USB_INSERTED)
|
||||||
{
|
{
|
||||||
/* Only disable the USB mode if we really have enabled it
|
/* Only disable the USB mode if we really have enabled it
|
||||||
|
@ -199,6 +219,9 @@ static void usb_thread(void)
|
||||||
num_acks_to_expect);
|
num_acks_to_expect);
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
lcd_icon(ICON_USB, false);
|
lcd_icon(ICON_USB, false);
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
/* how long until repeat kicks in */
|
/* how long until repeat kicks in */
|
||||||
#define REPEAT_START 6
|
#define REPEAT_START 6
|
||||||
|
@ -89,6 +90,15 @@ void button_event(int key, bool pressed)
|
||||||
case VK_SPACE:
|
case VK_SPACE:
|
||||||
new_btn = BUTTON_PLAY;
|
new_btn = BUTTON_PLAY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VK_NUMPAD0:
|
||||||
|
case VK_F5:
|
||||||
|
if(pressed)
|
||||||
|
{
|
||||||
|
screen_dump();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
#else
|
#else
|
||||||
case VK_RETURN:
|
case VK_RETURN:
|
||||||
new_btn = BUTTON_MENU;
|
new_btn = BUTTON_MENU;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
#include "X11/keysym.h"
|
#include "X11/keysym.h"
|
||||||
|
|
||||||
|
@ -131,6 +132,15 @@ static int get_raw_button (void)
|
||||||
case XK_3:
|
case XK_3:
|
||||||
k = BUTTON_F3;
|
k = BUTTON_F3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case XK_5:
|
||||||
|
if(!release)
|
||||||
|
{
|
||||||
|
screen_dump();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
case XK_KP_Add:
|
case XK_KP_Add:
|
||||||
case XK_Q:
|
case XK_Q:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue