mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-07 13:48:28 +02:00
simple_display: use proc_tools
Origin commit data
------------------
Commit: a88a066be1
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-11-13 (Mon, 13 Nov 2017)
Origin message was:
------------------
- simple_display: use proc_tools
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <driver/simple_display.h>
|
#include <driver/simple_display.h>
|
||||||
#include <driver/framebuffer.h>
|
#include <driver/framebuffer.h>
|
||||||
|
#include <system/proc_tools.h>
|
||||||
#include <system/set_threadname.h>
|
#include <system/set_threadname.h>
|
||||||
|
|
||||||
#include <global.h>
|
#include <global.h>
|
||||||
@@ -62,20 +63,6 @@ static bool timer_icon = false;
|
|||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
static bool usb_icon = false;
|
static bool usb_icon = false;
|
||||||
static bool timer_icon = false;
|
static bool timer_icon = false;
|
||||||
static int proc_put(const char *path, bool state)
|
|
||||||
{
|
|
||||||
int ret, ret2;
|
|
||||||
int pfd = open(path, O_WRONLY);
|
|
||||||
if (pfd < 0)
|
|
||||||
return pfd;
|
|
||||||
ret = write(pfd, state ? "1" : "0", 1);
|
|
||||||
ret2 = close(pfd);
|
|
||||||
if (ret2 < 0)
|
|
||||||
return ret2;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static int proc_put(const char *, bool) {return 0;}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char volume = 0;
|
static char volume = 0;
|
||||||
@@ -558,10 +545,7 @@ void CLCD::setBrightness(int dimm)
|
|||||||
}
|
}
|
||||||
#elif HAVE_ARM_HARDWARE
|
#elif HAVE_ARM_HARDWARE
|
||||||
std::string value = to_string(255/15*dimm);
|
std::string value = to_string(255/15*dimm);
|
||||||
int pfd = open("/proc/stb/lcd/oled_brightness", O_WRONLY);
|
proc_put("/proc/stb/lcd/oled_brightness", value.c_str(), value.length());
|
||||||
if (pfd)
|
|
||||||
write(pfd, value.c_str(), value.length());
|
|
||||||
close(pfd);
|
|
||||||
#else
|
#else
|
||||||
(void)dimm; // avoid compiler warning
|
(void)dimm; // avoid compiler warning
|
||||||
#endif
|
#endif
|
||||||
@@ -807,7 +791,7 @@ void CLCD::ShowIcon(fp_icon i, bool on)
|
|||||||
led_r = on;
|
led_r = on;
|
||||||
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) {
|
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) {
|
||||||
SetIcons(SPARK_REC1, on);
|
SetIcons(SPARK_REC1, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_recording",on);}
|
proc_put("/proc/stb/lcd/symbol_recording", on ? "1" : "0", 1);}
|
||||||
else
|
else
|
||||||
setled(led_r, -1); /* switch instant on / switch off if disabling */
|
setled(led_r, -1); /* switch instant on / switch off if disabling */
|
||||||
break;
|
break;
|
||||||
@@ -815,18 +799,18 @@ void CLCD::ShowIcon(fp_icon i, bool on)
|
|||||||
led_g = on;
|
led_g = on;
|
||||||
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) {
|
if (g_info.hw_caps->display_type == HW_DISPLAY_LINE_TEXT) {
|
||||||
SetIcons(SPARK_PLAY, on);
|
SetIcons(SPARK_PLAY, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_playback",on);}
|
proc_put("/proc/stb/lcd/symbol_playback", on ? "1" : "0", 1);}
|
||||||
else
|
else
|
||||||
setled(-1, led_g);
|
setled(-1, led_g);
|
||||||
break;
|
break;
|
||||||
case FP_ICON_USB:
|
case FP_ICON_USB:
|
||||||
usb_icon = on;
|
usb_icon = on;
|
||||||
SetIcons(SPARK_USB, on);
|
SetIcons(SPARK_USB, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_usb",on);
|
proc_put("/proc/stb/lcd/symbol_usb", on ? "1" : "0", 1);
|
||||||
break;
|
break;
|
||||||
case FP_ICON_HDD:
|
case FP_ICON_HDD:
|
||||||
SetIcons(SPARK_HDD, on);
|
SetIcons(SPARK_HDD, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_hdd",on);
|
proc_put("/proc/stb/lcd/symbol_hdd", on ? "1" : "0", 1);
|
||||||
break;
|
break;
|
||||||
case FP_ICON_PAUSE:
|
case FP_ICON_PAUSE:
|
||||||
SetIcons(SPARK_PAUSE, on);
|
SetIcons(SPARK_PAUSE, on);
|
||||||
@@ -843,14 +827,14 @@ void CLCD::ShowIcon(fp_icon i, bool on)
|
|||||||
break;
|
break;
|
||||||
case FP_ICON_LOCK:
|
case FP_ICON_LOCK:
|
||||||
SetIcons(SPARK_CA, on);
|
SetIcons(SPARK_CA, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_scrambled",on);
|
proc_put("/proc/stb/lcd/symbol_scrambled", on ? "1" : "0", 1);
|
||||||
break;
|
break;
|
||||||
case FP_ICON_RADIO:
|
case FP_ICON_RADIO:
|
||||||
SetIcons(SPARK_AUDIO, on);
|
SetIcons(SPARK_AUDIO, on);
|
||||||
break;
|
break;
|
||||||
case FP_ICON_TV:
|
case FP_ICON_TV:
|
||||||
SetIcons(SPARK_TVMODE_LOG, on);
|
SetIcons(SPARK_TVMODE_LOG, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_tv",on);
|
proc_put("/proc/stb/lcd/symbol_tv", on ? "1" : "0", 1);
|
||||||
break;
|
break;
|
||||||
case FP_ICON_HD:
|
case FP_ICON_HD:
|
||||||
SetIcons(SPARK_DOUBLESCREEN, on);
|
SetIcons(SPARK_DOUBLESCREEN, on);
|
||||||
@@ -858,14 +842,14 @@ void CLCD::ShowIcon(fp_icon i, bool on)
|
|||||||
case FP_ICON_CLOCK:
|
case FP_ICON_CLOCK:
|
||||||
timer_icon = on;
|
timer_icon = on;
|
||||||
SetIcons(SPARK_CLOCK, on);
|
SetIcons(SPARK_CLOCK, on);
|
||||||
proc_put("/proc/stb/lcd/symbol_timeshift",on);
|
proc_put("/proc/stb/lcd/symbol_timeshift", on ? "1" : "0", 1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVFD::ShowText(const char * str, bool update_timestamp)
|
void CLCD::ShowText(const char * str, bool update_timestamp)
|
||||||
{
|
{
|
||||||
int fd = dev_open();
|
int fd = dev_open();
|
||||||
int len = strlen(str);
|
int len = strlen(str);
|
||||||
|
Reference in New Issue
Block a user