Fix for T-Deck apps not showing up and added new kernel functionality

This commit is contained in:
Ken Van Hoeylandt 2026-02-09 20:14:55 +01:00
parent e750ec1919
commit e017b7415f
7 changed files with 51 additions and 16 deletions

View File

@ -32,6 +32,7 @@
#include <tactility/lvgl_module.h> #include <tactility/lvgl_module.h>
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
#include "tactility/drivers/root.h"
#include <Tactility/InitEsp.h> #include <Tactility/InitEsp.h>
#endif #endif
@ -61,8 +62,6 @@ namespace service {
namespace statusbar { extern const ServiceManifest manifest; } namespace statusbar { extern const ServiceManifest manifest; }
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
namespace displayidle { extern const ServiceManifest manifest; } namespace displayidle { extern const ServiceManifest manifest; }
#endif
#if defined(ESP_PLATFORM) && defined(CONFIG_TT_DEVICE_LILYGO_TDECK)
namespace keyboardidle { extern const ServiceManifest manifest; } namespace keyboardidle { extern const ServiceManifest manifest; }
#endif #endif
#if TT_FEATURE_SCREENSHOT_ENABLED #if TT_FEATURE_SCREENSHOT_ENABLED
@ -112,11 +111,8 @@ namespace app {
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
namespace crashdiagnostics { extern const AppManifest manifest; } namespace crashdiagnostics { extern const AppManifest manifest; }
namespace webserversettings { extern const AppManifest manifest; } namespace webserversettings { extern const AppManifest manifest; }
#endif namespace keyboardsettings { extern const AppManifest manifest; } // T-Deck only for now
namespace trackballsettings { extern const AppManifest manifest; } // T-Deck only for now
#if defined(ESP_PLATFORM) && defined(CONFIG_TT_DEVICE_LILYGO_TDECK)
namespace keyboardsettings { extern const AppManifest manifest; }
namespace trackballsettings { extern const AppManifest manifest; }
#endif #endif
#if TT_FEATURE_SCREENSHOT_ENABLED #if TT_FEATURE_SCREENSHOT_ENABLED
@ -162,11 +158,13 @@ static void registerInternalApps() {
addAppManifest(app::webserversettings::manifest); addAppManifest(app::webserversettings::manifest);
addAppManifest(app::crashdiagnostics::manifest); addAppManifest(app::crashdiagnostics::manifest);
addAppManifest(app::development::manifest); addAppManifest(app::development::manifest);
#endif // T-Deck only:
auto* root_device = device_find_by_name("/");
#if defined(ESP_PLATFORM) && defined(CONFIG_TT_DEVICE_LILYGO_TDECK) check(root_device);
addAppManifest(app::keyboardsettings::manifest); if (root_is_model(root_device, "LilyGO T-Deck")) {
addAppManifest(app::trackballsettings::manifest); addAppManifest(app::keyboardsettings::manifest);
addAppManifest(app::trackballsettings::manifest);
}
#endif #endif
#if defined(CONFIG_TINYUSB_MSC_ENABLED) && CONFIG_TINYUSB_MSC_ENABLED #if defined(CONFIG_TINYUSB_MSC_ENABLED) && CONFIG_TINYUSB_MSC_ENABLED
@ -251,13 +249,16 @@ static void registerAndStartSecondaryServices() {
addService(service::loader::manifest); addService(service::loader::manifest);
addService(service::gui::manifest); addService(service::gui::manifest);
addService(service::statusbar::manifest); addService(service::statusbar::manifest);
addService(service::memorychecker::manifest);
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
addService(service::displayidle::manifest); addService(service::displayidle::manifest);
// T-Deck only:
auto* root_device = device_find_by_name("/");
check(root_device);
if (root_is_model(root_device, "LilyGO T-Deck")) {
addService(service::keyboardidle::manifest);
}
#endif #endif
#if defined(ESP_PLATFORM) && defined(CONFIG_TT_DEVICE_LILYGO_TDECK)
addService(service::keyboardidle::manifest);
#endif
addService(service::memorychecker::manifest);
#if TT_FEATURE_SCREENSHOT_ENABLED #if TT_FEATURE_SCREENSHOT_ENABLED
addService(service::screenshot::manifest); addService(service::screenshot::manifest);
#endif #endif

View File

@ -178,6 +178,14 @@ struct Device* device_get_parent(struct Device* device);
*/ */
bool device_is_ready(const struct Device* device); bool device_is_ready(const struct Device* device);
/**
* Indicates whether the device is compatible with the given compatible string.
* @param[in] device non-null device pointer
* @param[in] compatible compatible string
* @return true if the device is compatible
*/
bool device_is_compatible(const struct Device* device, const char* compatible);
/** /**
* Set the driver data for a device. * Set the driver data for a device.
* *

View File

@ -2,6 +2,8 @@
#pragma once #pragma once
#include <stddef.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -10,6 +12,14 @@ struct RootConfig {
const char* model; const char* model;
}; };
/**
* Indicates whether the device's model matches the specified model.
* @param[in] device the device to check (non-null)
* @param[in] model the model to check against
* @return true if the device's model matches the specified model'
*/
bool root_is_model(const struct Device* device, const char* model);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -23,6 +23,7 @@ typedef int error_t;
#define ERROR_OUT_OF_MEMORY 9 #define ERROR_OUT_OF_MEMORY 9
#define ERROR_NOT_SUPPORTED 10 #define ERROR_NOT_SUPPORTED 10
#define ERROR_NOT_ALLOWED 11 #define ERROR_NOT_ALLOWED 11
#define ERROR_BUFFER_OVERFLOW 12
/** Convert an error_t to a human-readable text. Useful for logging. */ /** Convert an error_t to a human-readable text. Useful for logging. */
const char* error_to_string(error_t error); const char* error_to_string(error_t error);

View File

@ -277,6 +277,11 @@ bool device_is_ready(const struct Device* device) {
return device->internal->state.started; return device->internal->state.started;
} }
bool device_is_compatible(const struct Device* device, const char* compatible) {
if (device->internal->driver == nullptr) return false;
return driver_is_compatible(device->internal->driver, compatible);
}
void device_set_driver_data(struct Device* device, void* driver_data) { void device_set_driver_data(struct Device* device, void* driver_data) {
device->internal->driver_data = driver_data; device->internal->driver_data = driver_data;
} }

View File

@ -1,10 +1,16 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
#include <tactility/device.h>
#include <tactility/driver.h> #include <tactility/driver.h>
#include <tactility/drivers/root.h> #include <tactility/drivers/root.h>
extern "C" { extern "C" {
bool root_is_model(const struct Device* device, const char* buffer) {
auto* config = static_cast<const RootConfig*>(device->config);
return strcmp(config->model, buffer) == 0;
}
Driver root_driver = { Driver root_driver = {
.name = "root", .name = "root",
.compatible = (const char*[]) { "root", nullptr }, .compatible = (const char*[]) { "root", nullptr },

View File

@ -3,6 +3,7 @@
#include <tactility/drivers/gpio_controller.h> #include <tactility/drivers/gpio_controller.h>
#include <tactility/drivers/i2c_controller.h> #include <tactility/drivers/i2c_controller.h>
#include <tactility/drivers/i2s_controller.h> #include <tactility/drivers/i2s_controller.h>
#include <tactility/drivers/root.h>
#include <tactility/drivers/spi_controller.h> #include <tactility/drivers/spi_controller.h>
#include <tactility/drivers/uart_controller.h> #include <tactility/drivers/uart_controller.h>
#include <tactility/concurrent/dispatcher.h> #include <tactility/concurrent/dispatcher.h>
@ -36,6 +37,7 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
DEFINE_MODULE_SYMBOL(device_get_driver_data), DEFINE_MODULE_SYMBOL(device_get_driver_data),
DEFINE_MODULE_SYMBOL(device_is_added), DEFINE_MODULE_SYMBOL(device_is_added),
DEFINE_MODULE_SYMBOL(device_is_ready), DEFINE_MODULE_SYMBOL(device_is_ready),
DEFINE_MODULE_SYMBOL(device_is_compatible),
DEFINE_MODULE_SYMBOL(device_lock), DEFINE_MODULE_SYMBOL(device_lock),
DEFINE_MODULE_SYMBOL(device_try_lock), DEFINE_MODULE_SYMBOL(device_try_lock),
DEFINE_MODULE_SYMBOL(device_unlock), DEFINE_MODULE_SYMBOL(device_unlock),
@ -79,6 +81,8 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
DEFINE_MODULE_SYMBOL(i2s_controller_get_config), DEFINE_MODULE_SYMBOL(i2s_controller_get_config),
DEFINE_MODULE_SYMBOL(i2s_controller_reset), DEFINE_MODULE_SYMBOL(i2s_controller_reset),
DEFINE_MODULE_SYMBOL(I2S_CONTROLLER_TYPE), DEFINE_MODULE_SYMBOL(I2S_CONTROLLER_TYPE),
// drivers/root
DEFINE_MODULE_SYMBOL(root_is_model),
// drivers/spi_controller // drivers/spi_controller
DEFINE_MODULE_SYMBOL(spi_controller_lock), DEFINE_MODULE_SYMBOL(spi_controller_lock),
DEFINE_MODULE_SYMBOL(spi_controller_try_lock), DEFINE_MODULE_SYMBOL(spi_controller_try_lock),