kunlun2: power-libperfmgr: Enable dt2w
Signed-off-by: SamarV-121 <samarvispute121@gmail.com>
This commit is contained in:
parent
98dce4d4d5
commit
0b9dcc21d6
1 changed files with 30 additions and 1 deletions
|
@ -83,6 +83,32 @@ Power::Power(std::shared_ptr<HintManager> hm)
|
|||
ALOGI("PowerHAL ready to process hints");
|
||||
}
|
||||
|
||||
static int sysfs_write(const char *path, const char *s)
|
||||
{
|
||||
char buf[80];
|
||||
int len;
|
||||
int ret = 0;
|
||||
int fd = open(path, O_WRONLY);
|
||||
|
||||
if (fd < 0) {
|
||||
strerror_r(errno, buf, sizeof(buf));
|
||||
ALOGE("Error opening %s: %s\n", path, buf);
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
len = write(fd, s, strlen(s));
|
||||
if (len < 0) {
|
||||
strerror_r(errno, buf, sizeof(buf));
|
||||
ALOGE("Error writing to %s: %s\n", path, buf);
|
||||
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||
LOG(DEBUG) << "Power setMode: " << toString(type) << " to: " << enabled;
|
||||
ATRACE_INT(toString(type).c_str(), enabled);
|
||||
|
@ -131,7 +157,10 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
|||
}
|
||||
[[fallthrough]];
|
||||
case Mode::DOUBLE_TAP_TO_WAKE:
|
||||
[[fallthrough]];
|
||||
{
|
||||
sysfs_write("/sys/class/touch/tp_dev/gesture_on", enabled ? "1" : "0");
|
||||
}
|
||||
break;
|
||||
case Mode::FIXED_PERFORMANCE:
|
||||
[[fallthrough]];
|
||||
case Mode::EXPENSIVE_RENDERING:
|
||||
|
|
Loading…
Reference in a new issue