From ebce78113aa951353f8f0548ee5ef88eba904c7c Mon Sep 17 00:00:00 2001 From: AndroPlus Date: Fri, 23 Nov 2018 20:35:46 +0900 Subject: [PATCH 1/3] Add keylayout to use additional button on Mi MIX 3 AI button is useless in AOSP, so use it as camera key instead --- base.mk | 1 + files/mimix3-gpio-keys.kl | 33 +++++++++++++++++++++++++++++++++ rw-system.sh | 6 ++++++ 3 files changed, 40 insertions(+) create mode 100644 files/mimix3-gpio-keys.kl diff --git a/base.mk b/base.mk index 35091c0..e86083c 100644 --- a/base.mk +++ b/base.mk @@ -94,6 +94,7 @@ PRODUCT_COPY_FILES += \ device/phh/treble/files/huawei-fingerprint.kl:system/phh/huawei/fingerprint.kl \ device/phh/treble/files/samsung-sec_e-pen.idc:system/usr/idc/sec_e-pen.idc \ device/phh/treble/files/samsung-9810-floating_feature.xml:system/ph/sam-9810-flo_feat.xml \ + device/phh/treble/files/mimix3-gpio-keys.kl:system/phh/mimix3-gpio-keys.kl SELINUX_IGNORE_NEVERALLOWS := true diff --git a/files/mimix3-gpio-keys.kl b/files/mimix3-gpio-keys.kl new file mode 100644 index 0000000..6ec60e6 --- /dev/null +++ b/files/mimix3-gpio-keys.kl @@ -0,0 +1,33 @@ +# Copyright (c) 2013, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + +key 115 VOLUME_UP +key 114 VOLUME_DOWN +key 102 HOME +key 528 FOCUS +key 766 CAMERA +# AI +key 689 CAMERA diff --git a/rw-system.sh b/rw-system.sh index ca3469f..c90695e 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -74,6 +74,12 @@ changeKeylayout() { changed=true fi + if getprop ro.vendor.build.fingerprint |grep -iq -e iaomi/perseus;then + cp /system/phh/mimix3-gpio-keys.kl /mnt/phh/keylayout/gpio-keys.kl + chmod 0644 /mnt/phh/keylayout/gpio-keys.kl + changed=true + fi + if [ "$changed" == true ];then mount -o bind /mnt/phh/keylayout /system/usr/keylayout restorecon -R /system/usr/keylayout From c3faca50d55e0d6250268f3c34dfd8c33ad86fd2 Mon Sep 17 00:00:00 2001 From: AndroPlus Date: Fri, 23 Nov 2018 20:37:18 +0900 Subject: [PATCH 2/3] Fix fingerprint touch on Mi MIX 3 --- rw-system.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rw-system.sh b/rw-system.sh index c90695e..b8d1658 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -60,7 +60,7 @@ changeKeylayout() { chmod 0644 /mnt/phh/keylayout/gpio_keys.kl /mnt/phh/keylayout/sec_touchscreen.kl fi - if getprop ro.vendor.build.fingerprint |grep -iq -e xiaomi/polaris -e xiaomi/sirius -e xiaomi/dipper -e xiaomi/wayne -e xiaomi/jasmine -e xiaomi/jasmine_sprout;then + if getprop ro.vendor.build.fingerprint |grep -iq -e xiaomi/polaris -e xiaomi/sirius -e xiaomi/dipper -e xiaomi/wayne -e xiaomi/jasmine -e xiaomi/jasmine_sprout -e iaomi/perseus;then cp /system/phh/empty /mnt/phh/keylayout/uinput-goodix.kl chmod 0644 /mnt/phh/keylayout/uinput-goodix.kl cp /system/phh/empty /mnt/phh/keylayout/uinput-fpc.kl From 8e8455165397c32ab9714d775f407796ba12bb8a Mon Sep 17 00:00:00 2001 From: AndroPlus Date: Fri, 23 Nov 2018 21:14:55 +0900 Subject: [PATCH 3/3] Set key as assist for Mi MIX 3 --- files/mimix3-gpio-keys.kl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/files/mimix3-gpio-keys.kl b/files/mimix3-gpio-keys.kl index 6ec60e6..5b2e648 100644 --- a/files/mimix3-gpio-keys.kl +++ b/files/mimix3-gpio-keys.kl @@ -29,5 +29,4 @@ key 114 VOLUME_DOWN key 102 HOME key 528 FOCUS key 766 CAMERA -# AI -key 689 CAMERA +key 689 ASSIST