From 7afea6fe95d375919ab29e86e3051dee4ad753c1 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Mon, 3 Sep 2018 14:58:11 +0200 Subject: [PATCH] Override keylayouts on S9/Note9 to include assistant button, and hard press on home to wake up --- base.mk | 4 ++++ files/samsung-gpio_keys.kl | 11 +++++++++++ files/samsung-sec_touchscreen.kl | 29 +++++++++++++++++++++++++++++ rw-system.sh | 21 +++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 files/samsung-gpio_keys.kl create mode 100644 files/samsung-sec_touchscreen.kl diff --git a/base.mk b/base.mk index 9aa5695..4a3a463 100644 --- a/base.mk +++ b/base.mk @@ -85,3 +85,7 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ device/phh/treble/interfaces.xml:system/etc/permissions/interfaces.xml + +PRODUCT_COPY_FILES += \ + device/phh/treble/files/samsung-gpio_keys.kl:system/phh/samsung-gpio_keys.kl \ + device/phh/treble/files/samsung-sec_touchscreen.kl:system/phh/samsung-sec_touchscreen.kl diff --git a/files/samsung-gpio_keys.kl b/files/samsung-gpio_keys.kl new file mode 100644 index 0000000..ad90c03 --- /dev/null +++ b/files/samsung-gpio_keys.kl @@ -0,0 +1,11 @@ +# Copyright (C) 2018 The LineageOS Project +# SPDX-License-Identifier: Apache-2.0 + +key 114 VOLUME_DOWN +key 115 VOLUME_UP +key 116 POWER +key 703 ASSIST +key 103 SYSTEM_NAVIGATION_UP +key 105 SYSTEM_NAVIGATION_LEFT +key 106 SYSTEM_NAVIGATION_RIGHT +key 108 SYSTEM_NAVIGATION_DOWN diff --git a/files/samsung-sec_touchscreen.kl b/files/samsung-sec_touchscreen.kl new file mode 100644 index 0000000..eef666f --- /dev/null +++ b/files/samsung-sec_touchscreen.kl @@ -0,0 +1,29 @@ +# Copyright (c) 2015, 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 +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +key 172 WAKEUP + diff --git a/rw-system.sh b/rw-system.sh index 55310fe..cf84ea4 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -41,6 +41,25 @@ fixSPL() { fi } +changeKeylayout() { + cp -a /system/usr/keylayout /mnt/phh/keylayout + changed=false + + if getprop ro.vendor.build.fingerprint | \ + grep -qE -e ".*(crown|star)[q2]*lte.*" -e ".*(SC-0[23]K|SCV3[89]).*";then + changed=true + + cp /system/phh/samsung-gpio_keys.kl /mnt/phh/keylayout/gpio_keys.kl + cp /system/phh/samsung-sec_touchscreen.kl /mnt/phh/keylayout/sec_touchscreen.kl + chmod 0644 /mnt/phh/keylayout/gpio_keys.kl /mnt/phh/keylayout/sec_touchscreen.kl + fi + + if [ "$changed" == true ];then + mount -o bind /mnt/phh/keylayout /system/usr/keylayout + restorecon -R /system/usr/keylayout + fi +} + if mount -o remount,rw /system;then resize2fs $(grep ' /system ' /proc/mounts |cut -d ' ' -f 1) || true elif mount -o remount,rw /;then @@ -55,6 +74,8 @@ set +e fixSPL set -e +changeKeylayout + if grep vendor.huawei.hardware.biometrics.fingerprint /vendor/manifest.xml;then mount -o bind system/phh/huawei/fingerprint.kl /vendor/usr/keylayout/fingerprint.kl fi