diff options
-rw-r--r-- | cmhw/org/cyanogenmod/hardware/DisplayColorCalibration.java | 23 | ||||
-rw-r--r-- | sepolicy/file_contexts | 4 |
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 |