sm8150-common: tri-state-key: Add hall sensor calibration support
* Needed for OnePlus 7 (and possibly 7T). Change-Id: I8449041eec5c8ab4153bd2942ebc7fda9ceb743e
This commit is contained in:
parent
e9ea023e0a
commit
5d4b065ffc
|
@ -24,4 +24,5 @@ type sysfs_fod, sysfs_type, fs_type;
|
||||||
type sysfs_fpc, sysfs_type, fs_type;
|
type sysfs_fpc, sysfs_type, fs_type;
|
||||||
type sysfs_fsc, sysfs_type, fs_type;
|
type sysfs_fsc, sysfs_type, fs_type;
|
||||||
type sysfs_project_info, sysfs_type, fs_type;
|
type sysfs_project_info, sysfs_type, fs_type;
|
||||||
|
type sysfs_tri_state_key, sysfs_type, fs_type;
|
||||||
type sysfs_vl53l1, sysfs_type, fs_type;
|
type sysfs_vl53l1, sysfs_type, fs_type;
|
||||||
|
|
|
@ -61,7 +61,9 @@
|
||||||
/dev/socket/vl53l1_daemon u:object_r:vl53l1_socket:s0
|
/dev/socket/vl53l1_daemon u:object_r:vl53l1_socket:s0
|
||||||
|
|
||||||
# Sys files
|
# Sys files
|
||||||
|
/sys/bus/platform/devices/soc/soc:tri_state_key/hall_data_calib u:object_r:sysfs_tri_state_key:s0
|
||||||
/sys/devices/platform/soc/soc:fingerprint_detect/sensor_version u:object_r:sysfs_fpc:s0
|
/sys/devices/platform/soc/soc:fingerprint_detect/sensor_version u:object_r:sysfs_fpc:s0
|
||||||
|
/sys/devices/platform/soc/soc:tri_state_key/hall_data_calib u:object_r:sysfs_tri_state_key:s0
|
||||||
/sys/devices/platform/vendor/vendor:motor_pl(/.*)? u:object_r:sysfs_motor:s0
|
/sys/devices/platform/vendor/vendor:motor_pl(/.*)? u:object_r:sysfs_motor:s0
|
||||||
/sys/elliptic/engine/calibration_v2 u:object_r:sysfs_audio:s0
|
/sys/elliptic/engine/calibration_v2 u:object_r:sysfs_audio:s0
|
||||||
/sys/module/fsc(/.*)? u:object_r:sysfs_fsc:s0
|
/sys/module/fsc(/.*)? u:object_r:sysfs_fsc:s0
|
||||||
|
|
|
@ -5,3 +5,9 @@ init_daemon_domain(tri-state-key_daemon)
|
||||||
|
|
||||||
allow tri-state-key_daemon uhid_device:chr_file rw_file_perms;
|
allow tri-state-key_daemon uhid_device:chr_file rw_file_perms;
|
||||||
allow tri-state-key_daemon self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
|
allow tri-state-key_daemon self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl;
|
||||||
|
|
||||||
|
allow tri-state-key_daemon sysfs_tri_state_key:file w_file_perms;
|
||||||
|
|
||||||
|
allow tri-state-key_daemon mnt_vendor_file:dir search;
|
||||||
|
|
||||||
|
r_dir_file(tri-state-key_daemon, persist_engineer_file)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#define LOG_TAG "tri-state-key_daemon"
|
#define LOG_TAG "tri-state-key_daemon"
|
||||||
|
|
||||||
|
#include <android-base/file.h>
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
@ -24,10 +25,15 @@
|
||||||
|
|
||||||
#include "uevent_listener.h"
|
#include "uevent_listener.h"
|
||||||
|
|
||||||
|
#define HALL_CALIBRATION_DATA "/sys/bus/platform/devices/soc:tri_state_key/hall_data_calib"
|
||||||
|
#define HALL_PERSIST_CALIBRATION_DATA "/mnt/vendor/persist/engineermode/tri_state_hall_data"
|
||||||
|
|
||||||
#define KEY_MODE_NORMAL 601
|
#define KEY_MODE_NORMAL 601
|
||||||
#define KEY_MODE_VIBRATION 602
|
#define KEY_MODE_VIBRATION 602
|
||||||
#define KEY_MODE_SILENCE 603
|
#define KEY_MODE_SILENCE 603
|
||||||
|
|
||||||
|
using android::base::ReadFileToString;
|
||||||
|
using android::base::WriteStringToFile;
|
||||||
using android::Uevent;
|
using android::Uevent;
|
||||||
using android::UeventListener;
|
using android::UeventListener;
|
||||||
|
|
||||||
|
@ -39,6 +45,11 @@ int main() {
|
||||||
|
|
||||||
LOG(INFO) << "Started";
|
LOG(INFO) << "Started";
|
||||||
|
|
||||||
|
if (std::string hallData; ReadFileToString(HALL_PERSIST_CALIBRATION_DATA, &hallData)) {
|
||||||
|
std::replace(hallData.begin(), hallData.end(), ';', ',');
|
||||||
|
WriteStringToFile(hallData, HALL_CALIBRATION_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
uinputFd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
|
uinputFd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
|
||||||
if (uinputFd < 0) {
|
if (uinputFd < 0) {
|
||||||
LOG(ERROR) << "Unable to open uinput node";
|
LOG(ERROR) << "Unable to open uinput node";
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
on fs
|
on fs
|
||||||
|
chown system system /sys/bus/platform/devices/soc/soc\:tri_state_key/hall_data_calib
|
||||||
|
chown system system /mnt/vendor/persist/engineermode/tri_state_hall_data
|
||||||
|
|
||||||
start tri-state-key_daemon
|
start tri-state-key_daemon
|
||||||
|
|
||||||
service tri-state-key_daemon /vendor/bin/tri-state-key_daemon
|
service tri-state-key_daemon /vendor/bin/tri-state-key_daemon
|
||||||
|
|
Loading…
Reference in New Issue