48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
/*
|
|
* Copyright (c) 2025 Amlogic, Inc. All rights reserved.
|
|
*
|
|
* This source code is subject to the terms and conditions defined in the
|
|
* file 'LICENSE' which is part of this source code package.
|
|
*
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <signal.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include "key_detect.h"
|
|
#include "aml_log.h"
|
|
#include "lea_manager.h"
|
|
#include "lea_app.h"
|
|
|
|
|
|
lea_app_context_t g_app_ctx = {0};
|
|
|
|
static void signal_handler(int sig)
|
|
{
|
|
if (sig == SIGINT || sig == SIGTERM) {
|
|
AML_LOGI("\nReceived signal %d, shutting down...\n", sig);
|
|
g_main_loop_quit(g_app_ctx.main_loop);
|
|
}
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
AML_LOGE("LEA application started.\n");
|
|
setenv("XDG_RUNTIME_DIR", "/run", 1);
|
|
signal(SIGINT, signal_handler);
|
|
signal(SIGTERM, signal_handler);
|
|
|
|
lea_app_init();
|
|
|
|
g_app_ctx.main_loop = g_main_loop_new(NULL, FALSE);
|
|
|
|
g_main_loop_run(g_app_ctx.main_loop);
|
|
|
|
lea_app_deinit();
|
|
|
|
g_main_loop_unref(g_app_ctx.main_loop);
|
|
|
|
AML_LOGI("LEA application exited successfully.\n");
|
|
return 0;
|
|
} |