monitor hdmi changes to keep the backlight off
This commit is contained in:
parent
e2f7c63892
commit
6a7a06aba5
2 changed files with 8 additions and 1 deletions
|
|
@ -32,6 +32,7 @@ static pthread_t ports_pt;
|
||||||
|
|
||||||
#define JACK_STATE_PATH "/sys/class/switch/h2w/state"
|
#define JACK_STATE_PATH "/sys/class/switch/h2w/state"
|
||||||
#define HDMI_STATE_PATH "/sys/class/switch/hdmi/state"
|
#define HDMI_STATE_PATH "/sys/class/switch/hdmi/state"
|
||||||
|
#define BACKLIGHT_PATH "/sys/class/backlight/backlight.2/bl_power"
|
||||||
|
|
||||||
int getInt(char* path) {
|
int getInt(char* path) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
@ -68,6 +69,11 @@ static void* watchPorts(void *arg) {
|
||||||
had_hdmi = has_hdmi;
|
had_hdmi = has_hdmi;
|
||||||
SetHDMI(has_hdmi);
|
SetHDMI(has_hdmi);
|
||||||
}
|
}
|
||||||
|
else if (has_hdmi && !getInt(BACKLIGHT_PATH)) {
|
||||||
|
SetHDMI(has_hdmi);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ void SetRawBrightness(int val) { // 0 - 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
// this prevents exiting/launching from turning the screen back on
|
// this prevents exiting/launching from turning the screen back on
|
||||||
SetHDMI(GetHDMI()); // TODO: isn't working
|
// SetHDMI(GetHDMI()); // TODO: isn't working
|
||||||
}
|
}
|
||||||
void SetRawVolume(int val) { // 0 - 40
|
void SetRawVolume(int val) { // 0 - 40
|
||||||
int fd = open(VOLUME_PATH, O_WRONLY);
|
int fd = open(VOLUME_PATH, O_WRONLY);
|
||||||
|
|
@ -169,6 +169,7 @@ void SetJack(int value) {
|
||||||
int GetHDMI(void) {
|
int GetHDMI(void) {
|
||||||
// TODO: tmp, testing hdmi without an hdmi output
|
// TODO: tmp, testing hdmi without an hdmi output
|
||||||
// return settings->jack;
|
// return settings->jack;
|
||||||
|
// printf("GetHDMI() %i\n", settings->hdmi); fflush(stdout);
|
||||||
return settings->hdmi;
|
return settings->hdmi;
|
||||||
}
|
}
|
||||||
void SetHDMI(int value) {
|
void SetHDMI(int value) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue