summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Andrei Măceș <dmaces@nd.edu>2016-12-01 13:27:34 -0500
committerAndrei Măceș <dmaces@nd.edu>2016-12-04 04:14:59 -0800
commitd0cdb651c667befccb285d853a7bdded74822bb8 (patch)
treefd7122290d02b5ca64e40c88402ee2f33742b271
parent98079ac93ecc7263b53ed6c1d050ebb72f0829b7 (diff)
downloadhardware_ti_omap4-d0cdb651c667befccb285d853a7bdded74822bb8.tar.gz
hardware_ti_omap4-d0cdb651c667befccb285d853a7bdded74822bb8.tar.bz2
hardware_ti_omap4-d0cdb651c667befccb285d853a7bdded74822bb8.zip
cmhw: Account for devices that don't use manager0 sysfs paths
Change-Id: I5602bfe642ed1c3bae9b5209e43362f2b6c37852 (cherry picked from commit 453e2165e3dcba2274b21b5c0a395c8624d5a354)
-rw-r--r--cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java23
-rw-r--r--sepolicy/file_contexts4
2 files changed, 23 insertions, 4 deletions
diff --git a/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java b/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java
index 1cffbff..8dda4b5 100644
--- a/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java
+++ b/cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java
@@ -38,10 +38,29 @@ package org.cyanogenmod.hardware;
import org.cyanogenmod.internal.util.FileUtils;
public class DisplayColorCalibration {
- private static final String COLOR_FILE = "/sys/devices/platform/omapdss/manager0/cpr_coef";
- private static final String COLOR_FILE_CTRL = "/sys/devices/platform/omapdss/manager0/cpr_enable";
+ private static final String MGR_PATH = getManagerPath();
+
+ private static final String COLOR_FILE = MGR_PATH + "cpr_coef";
+ private static final String COLOR_FILE_CTRL = MGR_PATH + "cpr_enable";
+
private static int last_rgb[] = { 256, 256, 256 };
+ private static String getManagerPath() {
+ final String sysfs_root = "/sys/devices/platform/omapdss/";
+ final String disp_name = FileUtils.readOneLine(sysfs_root + "display0/name");
+
+ String mgr_path = "";
+
+ for (int mgr_idx = 0; mgr_idx < 3; mgr_idx++) {
+ mgr_path = sysfs_root + "manager" + mgr_idx + "/";
+ if (disp_name.equals(FileUtils.readOneLine(mgr_path + "display"))) {
+ break;
+ }
+ }
+
+ return mgr_path;
+ }
+
public static boolean isSupported() {
return true;
}
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 08d1b38..7621ac7 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -6,5 +6,5 @@
/system/bin/pvrsrvinit u:object_r:pvrsrvinit_exec:s0
# Hardware tunables
-/sys/devices/platform/omapdss/manager0/cpr_coef -- u:object_r:sysfs_hardware:s0
-/sys/devices/platform/omapdss/manager0/cpr_enable -- u:object_r:sysfs_hardware:s0
+/sys/devices/platform/omapdss/manager[0-2]/cpr_coef -- u:object_r:sysfs_hardware:s0
+/sys/devices/platform/omapdss/manager[0-2]/cpr_enable -- u:object_r:sysfs_hardware:s0