minui: adapt backlight blanking commit to TWRP
Change-Id: I79417d218c84fcdaf2ce5ecdf314031831d89575
This commit is contained in:
committed by
Jason Riordan
parent
a1aad1bd8c
commit
4a5db2d8b4
@@ -31,8 +31,16 @@ else
|
||||
LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_RECOVERY_LCD_BACKLIGHT_PATH),)
|
||||
LOCAL_CFLAGS += -DRECOVERY_LCD_BACKLIGHT_PATH=$(TARGET_RECOVERY_LCD_BACKLIGHT_PATH)
|
||||
ifneq ($(TW_BRIGHTNESS_PATH),)
|
||||
LOCAL_CFLAGS += -DTW_BRIGHTNESS_PATH=\"$(TW_BRIGHTNESS_PATH)\"
|
||||
endif
|
||||
ifneq ($(TW_MAX_BRIGHTNESS),)
|
||||
LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=$(TW_MAX_BRIGHTNESS)
|
||||
else
|
||||
LOCAL_CFLAGS += -DTW_MAX_BRIGHTNESS=255
|
||||
endif
|
||||
ifneq ($(TW_NO_SCREEN_BLANK),)
|
||||
LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
|
||||
endif
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
@@ -437,15 +437,17 @@ gr_pixel *gr_fb_data(void)
|
||||
|
||||
void gr_fb_blank(bool blank)
|
||||
{
|
||||
#ifdef RECOVERY_LCD_BACKLIGHT_PATH
|
||||
#if defined(TW_NO_SCREEN_BLANK) && defined(TW_BRIGHTNESS_PATH) && defined(TW_MAX_BRIGHTNESS)
|
||||
int fd;
|
||||
char brightness[4];
|
||||
snprintf(brightness, 4, "%03d", TW_MAX_BRIGHTNESS/2);
|
||||
|
||||
fd = open(RECOVERY_LCD_BACKLIGHT_PATH, O_RDWR);
|
||||
fd = open(TW_BRIGHTNESS_PATH, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror("cannot open LCD backlight");
|
||||
return;
|
||||
}
|
||||
write(fd, blank ? "000" : "127", 3);
|
||||
write(fd, blank ? "000" : brightness, 3);
|
||||
close(fd);
|
||||
#else
|
||||
int ret;
|
||||
|
||||
Reference in New Issue
Block a user