From 5160c90690c6c3881eec1aa7392d1473c9f865b3 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 20 Mar 2022 13:07:39 +0000 Subject: 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 --- bootloader/x1000/utils.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'bootloader/x1000/utils.c') diff --git a/bootloader/x1000/utils.c b/bootloader/x1000/utils.c index 629a2c6280..4d3fb69e57 100644 --- a/bootloader/x1000/utils.c +++ b/bootloader/x1000/utils.c @@ -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) -- cgit v1.2.3