From 2d56e19f2a3228d56358dc69c7b1397f843e8d64 Mon Sep 17 00:00:00 2001 From: "Kevin F. Haggerty" Date: Fri, 15 Jun 2018 14:53:38 -0600 Subject: [PATCH 1/2] libril: Build non-inlined android_atomic methods * All of the libsec-ril*.so libraries reference these symbols, but Google finally dropped the non-inlined versions from libcutils with Android 8.0. This could be handled with shims in numerous device trees, but shim semantics and implementation aren't exactly stable and we can handle it more cleanly here in one place. * See LineageOS/android_system_core@103e8f560 Change-Id: I787372b739f3ace0d9cbbc33e4bffafa6876665e --- ril/libril/ril_service.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ril/libril/ril_service.cpp b/ril/libril/ril_service.cpp index ad24bf3..9f010aa 100644 --- a/ril/libril/ril_service.cpp +++ b/ril/libril/ril_service.cpp @@ -27,6 +27,11 @@ #include #include +#define ANDROID_ATOMIC_INLINE +extern "C" { +#include +} + #define INVALID_HEX_CHAR 16 // Enable verbose logging From 8add9d232914deafb9e3b99e5c1af4fdb43b0044 Mon Sep 17 00:00:00 2001 From: ShevT Date: Thu, 5 Aug 2021 13:30:59 +0300 Subject: [PATCH 2/2] touch: Move device specfic defines to a header Change-Id: I81dcbea5393cf3426357e659f89ede050cf567fb --- hidl/touch/Android.bp | 1 + hidl/touch/GloveMode.cpp | 6 ++--- hidl/touch/GloveMode.h | 1 + hidl/touch/KeyDisabler.cpp | 6 ++--- hidl/touch/KeyDisabler.h | 1 + hidl/touch/StylusMode.cpp | 6 ++--- hidl/touch/StylusMode.h | 1 + hidl/touch/TouchscreenGesture.cpp | 2 +- hidl/touch/TouchscreenGesture.h | 1 + hidl/touch/include/samsung_touch.h | 39 ++++++++++++++++++++++++++++++ 10 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 hidl/touch/include/samsung_touch.h diff --git a/hidl/touch/Android.bp b/hidl/touch/Android.bp index 0197b6c..37ed613 100644 --- a/hidl/touch/Android.bp +++ b/hidl/touch/Android.bp @@ -20,6 +20,7 @@ cc_binary { // FIXME: this should be 'vendor: true' for modules that will eventually be // on AOSP. proprietary: true, + local_include_dirs: ["include"], srcs: [ "GloveMode.cpp", "KeyDisabler.cpp", diff --git a/hidl/touch/GloveMode.cpp b/hidl/touch/GloveMode.cpp index f059b61..124bca9 100644 --- a/hidl/touch/GloveMode.cpp +++ b/hidl/touch/GloveMode.cpp @@ -25,7 +25,7 @@ namespace V1_0 { namespace samsung { bool GloveMode::isSupported() { - std::ifstream file("/sys/class/sec/tsp/cmd_list"); + std::ifstream file(TSP_CMD_LIST_NODE); if (file.is_open()) { std::string line; while (getline(file, line)) { @@ -38,7 +38,7 @@ bool GloveMode::isSupported() { // Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow. Return GloveMode::isEnabled() { - std::ifstream file("/sys/class/sec/tsp/cmd_result"); + std::ifstream file(TSP_CMD_RESULT_NODE); if (file.is_open()) { std::string line; getline(file, line); @@ -49,7 +49,7 @@ Return GloveMode::isEnabled() { } Return GloveMode::setEnabled(bool enabled) { - std::ofstream file("/sys/class/sec/tsp/cmd"); + std::ofstream file(TSP_CMD_NODE); file << "glove_mode," << (enabled ? "1" : "0"); return true; } diff --git a/hidl/touch/GloveMode.h b/hidl/touch/GloveMode.h index 25489bc..38a522c 100644 --- a/hidl/touch/GloveMode.h +++ b/hidl/touch/GloveMode.h @@ -20,6 +20,7 @@ #include #include #include +#include "samsung_touch.h" namespace vendor { namespace lineage { diff --git a/hidl/touch/KeyDisabler.cpp b/hidl/touch/KeyDisabler.cpp index 54691a0..b94658b 100644 --- a/hidl/touch/KeyDisabler.cpp +++ b/hidl/touch/KeyDisabler.cpp @@ -25,13 +25,13 @@ namespace V1_0 { namespace samsung { bool KeyDisabler::isSupported() { - std::ofstream file("/sys/class/sec/sec_touchkey/input/enabled"); + std::ofstream file(KEY_DISABLER_NODE); return file.good(); } // Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow. Return KeyDisabler::isEnabled() { - std::ifstream file("/sys/class/sec/sec_touchkey/input/enabled"); + std::ifstream file(KEY_DISABLER_NODE); int status = -1; if (file.is_open()) { @@ -42,7 +42,7 @@ Return KeyDisabler::isEnabled() { } Return KeyDisabler::setEnabled(bool enabled) { - std::ofstream file("/sys/class/sec/sec_touchkey/input/enabled"); + std::ofstream file(KEY_DISABLER_NODE); file << (enabled ? "0" : "1"); return true; } diff --git a/hidl/touch/KeyDisabler.h b/hidl/touch/KeyDisabler.h index 9cab414..e6309ef 100644 --- a/hidl/touch/KeyDisabler.h +++ b/hidl/touch/KeyDisabler.h @@ -20,6 +20,7 @@ #include #include #include +#include "samsung_touch.h" namespace vendor { namespace lineage { diff --git a/hidl/touch/StylusMode.cpp b/hidl/touch/StylusMode.cpp index e3190db..6a2bfd3 100644 --- a/hidl/touch/StylusMode.cpp +++ b/hidl/touch/StylusMode.cpp @@ -25,7 +25,7 @@ namespace V1_0 { namespace samsung { bool StylusMode::isSupported() { - std::ifstream file("/sys/class/sec/tsp/cmd_list"); + std::ifstream file(TSP_CMD_LIST_NODE); if (file.is_open()) { std::string line; while (getline(file, line)) { @@ -38,7 +38,7 @@ bool StylusMode::isSupported() { // Methods from ::vendor::lineage::touch::V1_0::IStylusMode follow. Return StylusMode::isEnabled() { - std::ifstream file("/sys/class/sec/tsp/cmd_result"); + std::ifstream file(TSP_CMD_RESULT_NODE); if (file.is_open()) { std::string line; getline(file, line); @@ -49,7 +49,7 @@ Return StylusMode::isEnabled() { } Return StylusMode::setEnabled(bool enabled) { - std::ofstream file("/sys/class/sec/tsp/cmd"); + std::ofstream file(TSP_CMD_NODE); file << "hover_enable," << (enabled ? "1" : "0"); return true; } diff --git a/hidl/touch/StylusMode.h b/hidl/touch/StylusMode.h index 6226ca5..c9b12b2 100644 --- a/hidl/touch/StylusMode.h +++ b/hidl/touch/StylusMode.h @@ -20,6 +20,7 @@ #include #include #include +#include "samsung_touch.h" namespace vendor { namespace lineage { diff --git a/hidl/touch/TouchscreenGesture.cpp b/hidl/touch/TouchscreenGesture.cpp index c0091a6..113741e 100644 --- a/hidl/touch/TouchscreenGesture.cpp +++ b/hidl/touch/TouchscreenGesture.cpp @@ -24,7 +24,7 @@ namespace touch { namespace V1_0 { namespace samsung { -static constexpr const char* kGeasturePath = "/sys/class/sec/sec_epen/epen_gestures"; +static constexpr const char* kGeasturePath = TOUCHSCREEN_GESTURE_NODE; const std::map TouchscreenGesture::kGestureInfoMap = { // clang-format off diff --git a/hidl/touch/TouchscreenGesture.h b/hidl/touch/TouchscreenGesture.h index 35517f1..4d40847 100644 --- a/hidl/touch/TouchscreenGesture.h +++ b/hidl/touch/TouchscreenGesture.h @@ -20,6 +20,7 @@ #include #include #include +#include "samsung_touch.h" namespace vendor { namespace lineage { diff --git a/hidl/touch/include/samsung_touch.h b/hidl/touch/include/samsung_touch.h new file mode 100644 index 0000000..e44b1e0 --- /dev/null +++ b/hidl/touch/include/samsung_touch.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SAMSUNG_TOUCH_H +#define SAMSUNG_TOUCH_H + +/* + * Board specific nodes + * + * If your kernel exposes these controls in another place, you can either + * symlink to the locations given here, or override this header in your + * device tree. + */ + +// For GloveMode and StylusMode +#define TSP_CMD_LIST_NODE "/sys/class/sec/tsp/cmd_list" +#define TSP_CMD_RESULT_NODE "/sys/class/sec/tsp/cmd_result" +#define TSP_CMD_NODE "/sys/class/sec/tsp/cmd" + +// For KeyDisabler +#define KEY_DISABLER_NODE "/sys/class/sec/sec_touchkey/input/enabled" + +//For TouchscreenGesture +#define TOUCHSCREEN_GESTURE_NODE "/sys/class/sec/sec_epen/epen_gestures" + +#endif // SAMSUNG_TOUCH_H