X6833B: power: Adapt to our device usage

Signed-off-by: dodyirawan85 <40514988+dodyirawan85@users.noreply.github.com>
This commit is contained in:
dodyirawan85 2023-12-11 09:04:16 +07:00
parent ba2741e9eb
commit 3aa2b1f112
2 changed files with 4 additions and 16 deletions

View file

@ -9,15 +9,6 @@
#include <android-base/logging.h> #include <android-base/logging.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
// defines from drivers/input/touchscreen/xiaomi/xiaomi_touch.h
#define SET_CUR_VALUE 0
#define Touch_Doubletap_Mode 14
#define TOUCH_DEV_PATH "/dev/xiaomi-touch"
#define TOUCH_ID 0
#define TOUCH_MAGIC 0x5400
#define TOUCH_IOC_SETMODE TOUCH_MAGIC + SET_CUR_VALUE
namespace aidl { namespace aidl {
namespace android { namespace android {
namespace hardware { namespace hardware {
@ -40,10 +31,7 @@ bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) {
bool setDeviceSpecificMode(Mode type, bool enabled) { bool setDeviceSpecificMode(Mode type, bool enabled) {
switch (type) { switch (type) {
case Mode::DOUBLE_TAP_TO_WAKE: { case Mode::DOUBLE_TAP_TO_WAKE: {
int fd = open(TOUCH_DEV_PATH, O_RDWR); ::android::base::WriteStringToFile(enabled ? "cc1" : "cc2", TAP_TO_WAKE_NODE, true);
int arg[3] = {TOUCH_ID, Touch_Doubletap_Mode, enabled ? 1 : 0};
ioctl(fd, TOUCH_IOC_SETMODE, &arg);
close(fd);
return true; return true;
} }
default: default:

View file

@ -6,9 +6,9 @@ on init
mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw mkdir /mnt/media_rw/usbotg 0700 media_rw media_rw
mkdir /storage/usbotg 0700 root root mkdir /storage/usbotg 0700 root root
# Set xiaomi touch permissions # Set gesture touch permissions
chown system system /dev/xiaomi-touch chown system system /proc/gesture_function
chmod 0660 /dev/xiaomi-touch chmod 0660 /proc/gesture_function
on post-fs-data on post-fs-data