Make blank_fb() into a more generic write_bool() function

This commit is contained in:
Cameron Gutman
2022-11-08 21:45:27 -06:00
parent b2192eda25
commit f16dc469af
3 changed files with 10 additions and 10 deletions

View File

@@ -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;