wahoo: toggle special touch mode when VR mode is active

am: fee56b7311

Change-Id: I6b9792753b9071c653ba8dc9e0d3525956f8101c
This commit is contained in:
Steve Pfetsch
2017-08-02 20:34:44 +00:00
committed by android-build-merger
4 changed files with 19 additions and 0 deletions

View File

@@ -153,6 +153,8 @@ static void DumpTouch(int fd) {
if (!access("/sys/class/input/ftm4_touch", R_OK)) {
DumpFileToFd(fd, "STM touch firmware config",
"/sys/class/input/ftm4_touch/version");
DumpFileToFd(fd, "STM touch VR Mode",
"/sys/class/input/ftm4_touch/vrmode");
}
}

View File

@@ -484,6 +484,9 @@ on boot
# Make the ftm4 command node writeable from dumpstate
chown system system /sys/devices/virtual/input/ftm4_touch/cmd
# ftm4 VR mode
chown system system /sys/devices/virtual/input/ftm4_touch/vrmode
service init-elabel-sh /system/bin/init.elabel.sh
class late_start
user system

View File

@@ -1,2 +1,6 @@
# interact with thermal_config
set_prop(hal_vr, thermal_prop)
# Access to touch vrmode node
allow hal_vr sysfs_touch:dir r_dir_perms;
allow hal_vr sysfs_touch:file rw_file_perms;

View File

@@ -48,6 +48,16 @@ Return<void> VrDevice::setVrMode(bool enabled) {
if (!android::base::SetProperty("ctl.restart", "thermal-engine")) {
LOG(ERROR) << "Couldn't set thermal_engine restart property";
}
if (!access("/sys/class/input/ftm4_touch", R_OK)) {
FILE *f = fopen("/sys/class/input/ftm4_touch/vrmode", "w");
if (f) {
fprintf(f, "%d", (enabled ? 1 : 0));
fclose(f);
}
else {
LOG(ERROR) << "Couldn't open vrmode sysfs node";
}
}
return Void();
}