sm8450-common: udfps: Update fod_finger_state node based on actual udfps state
Change-Id: I9f468457acfe373b9fdab7df7a9065905629263c
This commit is contained in:
@@ -49,8 +49,10 @@ on boot
|
|||||||
chmod 0660 /dev/xiaomi-touch
|
chmod 0660 /dev/xiaomi-touch
|
||||||
|
|
||||||
# Touchscreen sensors
|
# Touchscreen sensors
|
||||||
|
chown system system /sys/class/touch/touch_dev/fod_finger_state
|
||||||
chown system system /sys/class/touch/touch_dev/fod_longpress_gesture_enabled
|
chown system system /sys/class/touch/touch_dev/fod_longpress_gesture_enabled
|
||||||
chown system system /sys/class/touch/touch_dev/fod_press_status
|
chown system system /sys/class/touch/touch_dev/fod_press_status
|
||||||
|
chmod 0660 /sys/class/touch/touch_dev/fod_finger_state
|
||||||
chmod 0660 /sys/class/touch/touch_dev/fod_longpress_gesture_enabled
|
chmod 0660 /sys/class/touch/touch_dev/fod_longpress_gesture_enabled
|
||||||
chmod 0660 /sys/class/touch/touch_dev/fod_press_status
|
chmod 0660 /sys/class/touch/touch_dev/fod_press_status
|
||||||
|
|
||||||
|
1
sepolicy/vendor/genfs_contexts
vendored
1
sepolicy/vendor/genfs_contexts
vendored
@@ -7,6 +7,7 @@ genfscon sysfs /devices/platform/soc/soc:xm_battmngr/power_supply/usb u:object_r
|
|||||||
genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc u:object_r:vendor_sysfs_fingerprint:s0
|
genfscon sysfs /devices/platform/soc/soc:fingerprint_fpc u:object_r:vendor_sysfs_fingerprint:s0
|
||||||
|
|
||||||
# Sensors
|
# Sensors
|
||||||
|
genfscon sysfs /devices/virtual/touch/touch_dev/fod_finger_state u:object_r:vendor_sysfs_sensors:s0
|
||||||
genfscon sysfs /devices/virtual/touch/touch_dev/fod_longpress_gesture_enabled u:object_r:vendor_sysfs_sensors:s0
|
genfscon sysfs /devices/virtual/touch/touch_dev/fod_longpress_gesture_enabled u:object_r:vendor_sysfs_sensors:s0
|
||||||
genfscon sysfs /devices/virtual/touch/touch_dev/fod_press_status u:object_r:vendor_sysfs_sensors:s0
|
genfscon sysfs /devices/virtual/touch/touch_dev/fod_press_status u:object_r:vendor_sysfs_sensors:s0
|
||||||
genfscon sysfs /devices/virtual/touch/touch_dev/gesture_double_tap_enabled u:object_r:vendor_sysfs_sensors:s0
|
genfscon sysfs /devices/virtual/touch/touch_dev/gesture_double_tap_enabled u:object_r:vendor_sysfs_sensors:s0
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <display/drm/mi_disp.h>
|
#include <display/drm/mi_disp.h>
|
||||||
|
#include <linux/xiaomi_touch.h>
|
||||||
|
|
||||||
#include "UdfpsHandler.h"
|
#include "UdfpsHandler.h"
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
#define PARAM_FOD_RELEASED 0
|
#define PARAM_FOD_RELEASED 0
|
||||||
|
|
||||||
#define DISP_FEATURE_PATH "/dev/mi_display/disp_feature"
|
#define DISP_FEATURE_PATH "/dev/mi_display/disp_feature"
|
||||||
|
#define TOUCH_DEV_PATH "/dev/xiaomi-touch"
|
||||||
|
|
||||||
using ::aidl::android::hardware::biometrics::fingerprint::AcquiredInfo;
|
using ::aidl::android::hardware::biometrics::fingerprint::AcquiredInfo;
|
||||||
|
|
||||||
@@ -73,6 +75,7 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
|||||||
void init(fingerprint_device_t* device) {
|
void init(fingerprint_device_t* device) {
|
||||||
mDevice = device;
|
mDevice = device;
|
||||||
disp_fd_ = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
|
disp_fd_ = android::base::unique_fd(open(DISP_FEATURE_PATH, O_RDWR));
|
||||||
|
touch_fd_ = android::base::unique_fd(open(TOUCH_DEV_PATH, O_RDWR));
|
||||||
|
|
||||||
// Thread to listen for fod ui changes
|
// Thread to listen for fod ui changes
|
||||||
std::thread([this]() {
|
std::thread([this]() {
|
||||||
@@ -134,6 +137,13 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
|||||||
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, y);
|
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, y);
|
||||||
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_PRESSED);
|
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, PARAM_FOD_PRESSED);
|
||||||
|
|
||||||
|
// Update fod_finger_state node in case hwmodule polls it
|
||||||
|
struct touch_mode_request touchRequest = {
|
||||||
|
.mode = TOUCH_MODE_FOD_FINGER_STATE,
|
||||||
|
.value = 1,
|
||||||
|
};
|
||||||
|
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &touchRequest);
|
||||||
|
|
||||||
// Request HBM
|
// Request HBM
|
||||||
disp_local_hbm_req req;
|
disp_local_hbm_req req;
|
||||||
req.base.flag = 0;
|
req.base.flag = 0;
|
||||||
@@ -155,6 +165,13 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
|||||||
req.base.disp_id = MI_DISP_PRIMARY;
|
req.base.disp_id = MI_DISP_PRIMARY;
|
||||||
req.local_hbm_value = LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP;
|
req.local_hbm_value = LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP;
|
||||||
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req);
|
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req);
|
||||||
|
|
||||||
|
// Update fod_finger_state node in case hwmodule polls it
|
||||||
|
struct touch_mode_request touchRequest = {
|
||||||
|
.mode = TOUCH_MODE_FOD_FINGER_STATE,
|
||||||
|
.value = 0,
|
||||||
|
};
|
||||||
|
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &touchRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAcquired(int32_t result, int32_t vendorCode) {
|
void onAcquired(int32_t result, int32_t vendorCode) {
|
||||||
@@ -171,6 +188,7 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
|||||||
private:
|
private:
|
||||||
fingerprint_device_t* mDevice;
|
fingerprint_device_t* mDevice;
|
||||||
android::base::unique_fd disp_fd_;
|
android::base::unique_fd disp_fd_;
|
||||||
|
android::base::unique_fd touch_fd_;
|
||||||
};
|
};
|
||||||
|
|
||||||
static UdfpsHandler* create() {
|
static UdfpsHandler* create() {
|
||||||
|
Reference in New Issue
Block a user