davinci: fod: Switch to in-kernel handling of changes

Change-Id: I242a57b42bb455835bbc0777878a93bca6b986e7
This commit is contained in:
Demon000 2020-05-23 12:35:10 +02:00 committed by Arian
parent d24f1a797c
commit 95126a384e
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9
3 changed files with 1 additions and 30 deletions

View File

@ -28,10 +28,6 @@
#define PARAM_NIT_FOD 1 #define PARAM_NIT_FOD 1
#define PARAM_NIT_NONE 0 #define PARAM_NIT_NONE 0
#define FOD_HBM_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display/fod_hbm"
#define FOD_HBM_ON 1
#define FOD_HBM_OFF 0
#define FOD_STATUS_PATH "/sys/devices/virtual/touch/tp_dev/fod_status" #define FOD_STATUS_PATH "/sys/devices/virtual/touch/tp_dev/fod_status"
#define FOD_STATUS_ON 1 #define FOD_STATUS_ON 1
#define FOD_STATUS_OFF 0 #define FOD_STATUS_OFF 0
@ -40,18 +36,8 @@
#define FOD_SENSOR_Y 1931 #define FOD_SENSOR_Y 1931
#define FOD_SENSOR_SIZE 190 #define FOD_SENSOR_SIZE 190
#define BRIGHTNESS_PATH "/sys/class/backlight/panel0-backlight/brightness"
namespace { namespace {
template <typename T>
static T get(const std::string& path, const T& def) {
std::ifstream file(path);
T result;
file >> result;
return file.fail() ? def : result;
}
template <typename T> template <typename T>
static void set(const std::string& path, const T& value) { static void set(const std::string& path, const T& value) {
std::ofstream file(path); std::ofstream file(path);
@ -93,13 +79,11 @@ Return<void> FingerprintInscreen::onFinishEnroll() {
} }
Return<void> FingerprintInscreen::onPress() { Return<void> FingerprintInscreen::onPress() {
set(FOD_HBM_PATH, FOD_HBM_ON);
xiaomiFingerprintService->extCmd(COMMAND_NIT, PARAM_NIT_FOD); xiaomiFingerprintService->extCmd(COMMAND_NIT, PARAM_NIT_FOD);
return Void(); return Void();
} }
Return<void> FingerprintInscreen::onRelease() { Return<void> FingerprintInscreen::onRelease() {
set(FOD_HBM_PATH, FOD_HBM_OFF);
xiaomiFingerprintService->extCmd(COMMAND_NIT, PARAM_NIT_NONE); xiaomiFingerprintService->extCmd(COMMAND_NIT, PARAM_NIT_NONE);
return Void(); return Void();
} }
@ -151,16 +135,7 @@ Return<void> FingerprintInscreen::setLongPressEnabled(bool) {
} }
Return<int32_t> FingerprintInscreen::getDimAmount(int32_t /* brightness */) { Return<int32_t> FingerprintInscreen::getDimAmount(int32_t /* brightness */) {
int realBrightness = get(BRIGHTNESS_PATH, 0); return 0;
float alpha;
if (realBrightness > 500) {
alpha = 1.0 - pow(realBrightness / 2047.0 * 430.0 / 600.0, 0.455);
} else {
alpha = 1.0 - pow(realBrightness / 1680.0, 0.455);
}
return 255 * alpha;
} }
Return<bool> FingerprintInscreen::shouldBoostBrightness() { Return<bool> FingerprintInscreen::shouldBoostBrightness() {

View File

@ -1,8 +1,5 @@
on boot on boot
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/fod_hbm
chown system system /sys/devices/virtual/touch/tp_dev/fod_status chown system system /sys/devices/virtual/touch/tp_dev/fod_status
chmod 0644 /sys/devices/platform/soc/soc:qcom,dsi-display/fod_hbm
chmod 0644 /sys/devices/virtual/touch/tp_dev/fod_status chmod 0644 /sys/devices/virtual/touch/tp_dev/fod_status
service vendor.fingerprint-inscreen-1-0 /vendor/bin/hw/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci service vendor.fingerprint-inscreen-1-0 /vendor/bin/hw/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci

View File

@ -9,7 +9,6 @@
/data/vendor/goodix(/.*)? u:object_r:fingerprint_data_file:s0 /data/vendor/goodix(/.*)? u:object_r:fingerprint_data_file:s0
# FOD # FOD
/sys/devices/platform/soc/soc:qcom,dsi-display/fod_hbm u:object_r:sysfs_fod:s0
/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:sysfs_fod:s0 /sys/devices/virtual/touch/tp_dev/fod_status u:object_r:sysfs_fod:s0
# HALs # HALs