This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sm8250-common: Use MMI touchscreen class to toggle st2w/dt2w
Change-Id: I295f5d71d7a4cb416edfc5eb9d0c043cf75f7101
- Loading branch information
Showing
11 changed files
with
100 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,6 +421,9 @@ PRODUCT_PACKAGES += \ | |
PRODUCT_PACKAGES += \ | ||
[email protected]_kona | ||
|
||
PRODUCT_COPY_FILES += \ | ||
$(LOCAL_PATH)/configs/keylayout/double-tap.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/double-tap.kl | ||
|
||
# USB HAL | ||
PRODUCT_PACKAGES += \ | ||
[email protected] \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
key 62 WAKEUP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// Copyright (C) 2022 The LineageOS Project | ||
// Copyright (C) 2022-2023 The LineageOS Project | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
|
@@ -18,7 +18,6 @@ soong_config_module_type { | |
module_type: "cc_defaults", | ||
config_namespace: "MOTO_KONA_TOUCH", | ||
bool_variables: ["USE_TOUCH_POLLING_RATE"], | ||
value_variables: ["SINGLE_TAP_PATH"], | ||
properties: [ | ||
"cppflags", | ||
"srcs", | ||
|
@@ -34,11 +33,6 @@ moto_kona_touch_hal { | |
srcs: ["HighTouchPollingRate.cpp"], | ||
vintf_fragments: ["[email protected]_kona.hpr.xml"], | ||
}, | ||
SINGLE_TAP_PATH: { | ||
cppflags: ["-DSINGLE_TAP_PATH=\"%s\""], | ||
srcs: ["TouchscreenGesture.cpp"], | ||
vintf_fragments: ["[email protected]_kona.gesture.xml"], | ||
}, | ||
}, | ||
} | ||
|
||
|
@@ -53,7 +47,9 @@ cc_binary { | |
vendor: true, | ||
srcs: [ | ||
"service.cpp", | ||
"TouchscreenGesture.cpp", | ||
], | ||
vintf_fragments: ["[email protected]_kona.gesture.xml"], | ||
shared_libs: [ | ||
"libbase", | ||
"libhidlbase", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2023 The LineageOS Project | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <android-base/file.h> | ||
#include <android-base/strings.h> | ||
|
||
namespace mmi_gesture { | ||
|
||
constexpr auto kGestureNode = "/sys/class/touchscreen/primary/gesture"; | ||
constexpr auto kGestureModeTypeNode = "/sys/class/touchscreen/primary/gesture_mode_type"; | ||
|
||
// Keep them in sync with the kernel | ||
enum class Gesture { kSingleTap = 0x20, kDoubleTap = 0x30 }; | ||
|
||
inline bool IsEnabled(Gesture gesture) { | ||
std::string buf; | ||
if (!android::base::ReadFileToString(kGestureModeTypeNode, &buf)) { | ||
return false; | ||
} | ||
|
||
// Bits 0-2 correspond to zero tap, single tap, and double tap | ||
std::bitset<3> gesture_mode_type = std::stoi(android::base::Trim(buf)); | ||
switch (gesture) { | ||
case Gesture::kSingleTap: | ||
return gesture_mode_type[1]; | ||
case Gesture::kDoubleTap: | ||
return gesture_mode_type[2]; | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
inline bool SetEnabled(Gesture gesture, bool enabled) { | ||
int code = static_cast<int>(gesture); | ||
if (enabled) ++code; | ||
if (!android::base::WriteStringToFile(std::to_string(code), kGestureNode)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace mmi_gesture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2023 The LineageOS Project | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <aidl/android/hardware/power/BnPower.h> | ||
#include "MMIGesture.h" | ||
|
||
namespace aidl { | ||
namespace android { | ||
namespace hardware { | ||
namespace power { | ||
namespace impl { | ||
|
||
bool isDeviceSpecificModeSupported(Mode type, bool* _aidl_return) { | ||
if (type == Mode::DOUBLE_TAP_TO_WAKE) { | ||
*_aidl_return = true; | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
bool setDeviceSpecificMode(Mode type, bool enabled) { | ||
if (type != Mode::DOUBLE_TAP_TO_WAKE) return false; | ||
return mmi_gesture::SetEnabled(mmi_gesture::Gesture::kDoubleTap, enabled); | ||
} | ||
|
||
} // namespace impl | ||
} // namespace power | ||
} // namespace hardware | ||
} // namespace android | ||
} // namespace aidl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
on early-boot | ||
chown system system /sys/class/touchscreen/primary/gesture | ||
chown system system /sys/class/touchscreen/primary/gesture_mode_type | ||
chown system system /sys/class/touchscreen/primary/interpolation | ||
|
||
service touch-hal-1-0 /vendor/bin/hw/[email protected]_kona | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
aw8695.ko | ||
mmi_annotate.ko | ||
mmi_info.ko | ||
mmi_relay.ko | ||
qpnp-smbcharger-mmi.ko | ||
qpnp_adaptive_charge.ko | ||
sensors_class.ko | ||
touchscreen_mmi.ko |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters