1
0
Fork 0
forked from len0rd/rockbox

x1000: bootloader: add screenshot function

Screenshots of the recovery menu will be useful for documentation.

This can be disabled by turning off HAVE_BOOTLOADER_SCREENDUMP in
the target config file if the bootloader should ever run up against
max size limits.

Change-Id: I62ec1e465df2ca7a8a0e78625d88b31f6c4ef078
This commit is contained in:
Aidan MacDonald 2022-03-20 13:07:39 +00:00
parent 4cf36dfbf3
commit 5160c90690
7 changed files with 47 additions and 4 deletions

View file

@ -29,6 +29,7 @@
#include "rb-loader.h"
#include "loader_strerror.h"
#include "linuxboot.h"
#include "screendump.h"
#include "nand-x1000.h"
/* Set to true if a SYS_USB_CONNECTED event is seen
@ -37,6 +38,8 @@
* TODO: this is an ugly kludge */
bool is_usb_connected = false;
static bool screenshot_enabled = false;
/* this is both incorrect and incredibly racy... */
int check_disk(bool wait)
{
@ -75,6 +78,25 @@ void usb_mode(void)
splashf(3*HZ, "USB disconnected");
}
void screenshot(void)
{
#ifdef HAVE_SCREENDUMP
if(!screenshot_enabled || check_disk(false) != DISK_PRESENT)
return;
screen_dump();
#endif
}
void screenshot_enable(void)
{
#ifdef HAVE_SCREENDUMP
splashf(3*HZ, "Screenshots enabled\nPress %s for screenshot",
BL_SCREENSHOT_NAME);
screenshot_enabled = true;
#endif
}
int load_rockbox(const char* filename, size_t* sizep)
{
if(check_disk(true) != DISK_PRESENT)