Add hostname

This commit is contained in:
fvanroie 2021-03-09 20:23:30 +01:00
parent ffb732ce7f
commit 3109960e25
3 changed files with 29 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#if defined(POSIX)
#include <cstdint>
#include <sys/utsname.h>
#include "hasp_posix.h"
@ -10,14 +11,29 @@
#include "display/monitor.h"
extern monitor_t monitor;
namespace dev {
void PosixDevice::reboot()
{}
void PosixDevice::show_info()
{
LOG_VERBOSE(0, F("Processor : %s"), "unknown");
LOG_VERBOSE(0, F("CPU freq. : %i MHz"), 0);
struct utsname uts;
if (uname(&uts) < 0) {
LOG_ERROR(0,"uname() error");
} else {
LOG_VERBOSE(0,"Sysname: %s", uts.sysname);
LOG_VERBOSE(0,"Nodename: %s", uts.nodename);
LOG_VERBOSE(0,"Release: %s", uts.release);
LOG_VERBOSE(0,"Version: %s", uts.version);
LOG_VERBOSE(0,"Machine: %s", uts.machine);
}
LOG_VERBOSE(0, "Processor : %s", "unknown");
LOG_VERBOSE(0, "CPU freq. : %i MHz", 0);
}
@ -28,6 +44,7 @@ const char* PosixDevice::get_hostname()
void PosixDevice::set_hostname(const char* hostname)
{
_hostname = hostname;
SDL_SetWindowTitle(monitor.window, hostname);
}
const char* PosixDevice::get_core_version()
{
@ -73,7 +90,14 @@ bool PosixDevice::get_backlight_power()
void PosixDevice::update_backlight()
{
monitor_backlight(_backlight_power ? map(_backlight_level, 0, 100, 0, 255) : 0);
uint8_t level = _backlight_power ? map(_backlight_level, 0, 100, 0, 255) : 0;
SDL_SetTextureColorMod(monitor.texture, level, level, level);
// window_update(&monitor);
monitor.sdl_refr_qry = true;
// monitor_sdl_refr(NULL);
const lv_area_t area = {1,1,0,0};
//monitor_flush(NULL,&area,NULL);
}
size_t PosixDevice::get_free_max_block()

View File

@ -49,6 +49,7 @@ const char* Win32Device::get_hostname()
void Win32Device::set_hostname(const char* hostname)
{
_hostname = hostname;
SDL_SetWindowTitle(monitor.window, hostname);
}
const char* Win32Device::get_core_version()
{

View File

@ -55,6 +55,7 @@ lib_deps =
;lv_drivers=https://github.com/littlevgl/lv_drivers/archive/7d71907c1d6b02797d066f50984b866e080ebeed.zip
https://github.com/eclipse/paho.mqtt.c.git
bblanchon/ArduinoJson@^6.17.2 ; Json(l) parser
https://github.com/fvanroie/lv_drivers
lib_ignore =
paho