mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-03 16:25:31 +00:00
Make blank_fb() into a more generic write_bool() function
This commit is contained in:
parent
b2192eda25
commit
f16dc469af
@ -104,13 +104,13 @@ void platform_start(enum platform system) {
|
||||
switch (system) {
|
||||
#ifdef HAVE_AML
|
||||
case AML:
|
||||
blank_fb("/sys/class/graphics/fb0/blank", true);
|
||||
blank_fb("/sys/class/graphics/fb1/blank", true);
|
||||
write_bool("/sys/class/graphics/fb0/blank", true);
|
||||
write_bool("/sys/class/graphics/fb1/blank", true);
|
||||
break;
|
||||
#endif
|
||||
#if defined(HAVE_PI) | defined(HAVE_MMAL)
|
||||
case PI:
|
||||
blank_fb("/sys/class/graphics/fb0/blank", true);
|
||||
write_bool("/sys/class/graphics/fb0/blank", true);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@ -120,13 +120,13 @@ void platform_stop(enum platform system) {
|
||||
switch (system) {
|
||||
#ifdef HAVE_AML
|
||||
case AML:
|
||||
blank_fb("/sys/class/graphics/fb0/blank", false);
|
||||
blank_fb("/sys/class/graphics/fb1/blank", false);
|
||||
write_bool("/sys/class/graphics/fb0/blank", false);
|
||||
write_bool("/sys/class/graphics/fb1/blank", false);
|
||||
break;
|
||||
#endif
|
||||
#if defined(HAVE_PI) | defined(HAVE_MMAL)
|
||||
case PI:
|
||||
blank_fb("/sys/class/graphics/fb0/blank", false);
|
||||
write_bool("/sys/class/graphics/fb0/blank", false);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -25,13 +25,13 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int blank_fb(char *path, bool clear) {
|
||||
int write_bool(char *path, bool val) {
|
||||
int fd = open(path, O_RDWR);
|
||||
|
||||
if(fd >= 0) {
|
||||
int ret = write(fd, clear ? "1" : "0", 1);
|
||||
int ret = write(fd, val ? "1" : "0", 1);
|
||||
if (ret < 0)
|
||||
fprintf(stderr, "Failed to clear framebuffer %s: %d\n", path, ret);
|
||||
fprintf(stderr, "Failed to write %d to %s: %d\n", val ? 1 : 0, path, ret);
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
|
@ -19,5 +19,5 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
int blank_fb(char *path, bool clear);
|
||||
int write_bool(char *path, bool val);
|
||||
int read_file(char *path, char *output, int output_len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user