From b9ce0498768ff9e598cabce342f18d3639e6aa96 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 17 Jan 2026 21:23:19 -0500 Subject: [PATCH] debug: show touchscreen info in the hw debug screen on hibylinux targets Also add this debug screen to the hiby r1 / r3proii targets. Change-Id: Ia255571838baef9900f6b6a3c395c10b872f5f5a --- apps/debug_menu.c | 2 +- firmware/SOURCES | 2 ++ firmware/export/touchscreen.h | 2 ++ firmware/target/hosted/agptek/debug-agptek.c | 8 ++++++++ firmware/target/hosted/button-devinput.c | 9 ++++++++- firmware/target/hosted/hiby/debug-hiby.c | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 firmware/target/hosted/hiby/debug-hiby.c diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 243babfb10..61788fe559 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -2846,7 +2846,7 @@ static const struct { { "Screendump", dbg_screendump }, #endif { "Skin Engine RAM usage", dbg_skin_engine }, -#if ((CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SONY_NWZ_LINUX) || (defined(HIBY_LINUX) && !defined(HIBY_R3PROII) && !defined(HIBY_R1)) || defined(FIIO_M3K_LINUX)) && !defined(SIMULATOR) +#if ((CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SONY_NWZ_LINUX) || defined(HIBY_LINUX) || defined(FIIO_M3K_LINUX)) && !defined(SIMULATOR) { "View HW info", dbg_hw_info }, #endif #if (CONFIG_PLATFORM & PLATFORM_NATIVE) diff --git a/firmware/SOURCES b/firmware/SOURCES index 294c3f6185..6be052de85 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -163,6 +163,7 @@ target/hosted/power-linux.c target/hosted/hiby/usb-hiby-gadget.c target/hosted/hiby/r3proii/button-r3proii.c target/hosted/hiby/r3proii/powermgmt-r3proii.c +target/hosted/hiby/debug-hiby.c #ifndef BOOTLOADER target/hosted/hiby/r3proii/led-r3proii.c target/hosted/hiby/hibylinux_codec.c @@ -173,6 +174,7 @@ target/hosted/hiby/hibylinux_codec.c target/hosted/hiby/usb-hiby-gadget.c target/hosted/hiby/r1/button-r1.c target/hosted/hiby/r1/powermgmt-r1.c +target/hosted/hiby/debug-hiby.c #ifndef BOOTLOADER target/hosted/hiby/r1/led-r1.c target/hosted/hiby/hibylinux_codec.c diff --git a/firmware/export/touchscreen.h b/firmware/export/touchscreen.h index f33b043c94..5e107e8ef2 100644 --- a/firmware/export/touchscreen.h +++ b/firmware/export/touchscreen.h @@ -72,4 +72,6 @@ void touchscreen_enable_device(bool en); bool touchscreen_is_enabled(void); #endif +void touchscreen_last_state(int *x, int *y, int *state); + #endif /* __TOUCHSCREEN_INCLUDE_H_ */ diff --git a/firmware/target/hosted/agptek/debug-agptek.c b/firmware/target/hosted/agptek/debug-agptek.c index 81c53d56eb..b6ccad6eae 100644 --- a/firmware/target/hosted/agptek/debug-agptek.c +++ b/firmware/target/hosted/agptek/debug-agptek.c @@ -88,6 +88,14 @@ bool dbg_hw_info(void) #endif lcd_putsf(0, line++, "btn: 0x%x", btn); +#ifdef HAVE_TOUCHSCREEN + int x; + int y; + int state; + touchscreen_last_state(&x, &y, &state); + lcd_putsf(0, line++, "touch: x %d y %d st %d", x, y, state); +#endif + lcd_update(); sleep(HZ/16); } diff --git a/firmware/target/hosted/button-devinput.c b/firmware/target/hosted/button-devinput.c index 19ed3fcba7..343f1a4fe8 100644 --- a/firmware/target/hosted/button-devinput.c +++ b/firmware/target/hosted/button-devinput.c @@ -107,10 +107,17 @@ static enum // XXX ... figure out what is standard. #define EVENT_VALUE_TOUCHSCREEN_PRESS 1 -#define EVENT_VALUE_TOUCHSCREEN_RELEASE -1 +#define EVENT_VALUE_TOUCHSCREEN_RELEASE 0 static int ts_enabled = 1; +void touchscreen_last_state(int *x, int *y, int *state) +{ + *x = _last_x; + *y = _last_y; + *state = _last_touch_state; +} + void touchscreen_enable_device(bool en) { ts_enabled = en; diff --git a/firmware/target/hosted/hiby/debug-hiby.c b/firmware/target/hosted/hiby/debug-hiby.c new file mode 100644 index 0000000000..9812b8f8b9 --- /dev/null +++ b/firmware/target/hosted/hiby/debug-hiby.c @@ -0,0 +1 @@ +#include "../agptek/debug-agptek.c"