mirror of
https://github.com/team-infusion-developers/android_hardware_samsung.git
synced 2024-11-06 21:55:41 +00:00
commit
e99890dd9f
11 changed files with 59 additions and 10 deletions
|
@ -20,6 +20,7 @@ cc_binary {
|
||||||
// FIXME: this should be 'vendor: true' for modules that will eventually be
|
// FIXME: this should be 'vendor: true' for modules that will eventually be
|
||||||
// on AOSP.
|
// on AOSP.
|
||||||
proprietary: true,
|
proprietary: true,
|
||||||
|
local_include_dirs: ["include"],
|
||||||
srcs: [
|
srcs: [
|
||||||
"GloveMode.cpp",
|
"GloveMode.cpp",
|
||||||
"KeyDisabler.cpp",
|
"KeyDisabler.cpp",
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace V1_0 {
|
||||||
namespace samsung {
|
namespace samsung {
|
||||||
|
|
||||||
bool GloveMode::isSupported() {
|
bool GloveMode::isSupported() {
|
||||||
std::ifstream file("/sys/class/sec/tsp/cmd_list");
|
std::ifstream file(TSP_CMD_LIST_NODE);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
while (getline(file, line)) {
|
while (getline(file, line)) {
|
||||||
|
@ -38,7 +38,7 @@ bool GloveMode::isSupported() {
|
||||||
|
|
||||||
// Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow.
|
// Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow.
|
||||||
Return<bool> GloveMode::isEnabled() {
|
Return<bool> GloveMode::isEnabled() {
|
||||||
std::ifstream file("/sys/class/sec/tsp/cmd_result");
|
std::ifstream file(TSP_CMD_RESULT_NODE);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
getline(file, line);
|
getline(file, line);
|
||||||
|
@ -49,7 +49,7 @@ Return<bool> GloveMode::isEnabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> GloveMode::setEnabled(bool enabled) {
|
Return<bool> GloveMode::setEnabled(bool enabled) {
|
||||||
std::ofstream file("/sys/class/sec/tsp/cmd");
|
std::ofstream file(TSP_CMD_NODE);
|
||||||
file << "glove_mode," << (enabled ? "1" : "0");
|
file << "glove_mode," << (enabled ? "1" : "0");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <hidl/MQDescriptor.h>
|
#include <hidl/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
#include <vendor/lineage/touch/1.0/IGloveMode.h>
|
#include <vendor/lineage/touch/1.0/IGloveMode.h>
|
||||||
|
#include "samsung_touch.h"
|
||||||
|
|
||||||
namespace vendor {
|
namespace vendor {
|
||||||
namespace lineage {
|
namespace lineage {
|
||||||
|
|
|
@ -25,13 +25,13 @@ namespace V1_0 {
|
||||||
namespace samsung {
|
namespace samsung {
|
||||||
|
|
||||||
bool KeyDisabler::isSupported() {
|
bool KeyDisabler::isSupported() {
|
||||||
std::ofstream file("/sys/class/sec/sec_touchkey/input/enabled");
|
std::ofstream file(KEY_DISABLER_NODE);
|
||||||
return file.good();
|
return file.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow.
|
// Methods from ::vendor::lineage::touch::V1_0::IKeyDisabler follow.
|
||||||
Return<bool> KeyDisabler::isEnabled() {
|
Return<bool> KeyDisabler::isEnabled() {
|
||||||
std::ifstream file("/sys/class/sec/sec_touchkey/input/enabled");
|
std::ifstream file(KEY_DISABLER_NODE);
|
||||||
int status = -1;
|
int status = -1;
|
||||||
|
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
|
@ -42,7 +42,7 @@ Return<bool> KeyDisabler::isEnabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> KeyDisabler::setEnabled(bool enabled) {
|
Return<bool> KeyDisabler::setEnabled(bool enabled) {
|
||||||
std::ofstream file("/sys/class/sec/sec_touchkey/input/enabled");
|
std::ofstream file(KEY_DISABLER_NODE);
|
||||||
file << (enabled ? "0" : "1");
|
file << (enabled ? "0" : "1");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <hidl/MQDescriptor.h>
|
#include <hidl/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
#include <vendor/lineage/touch/1.0/IKeyDisabler.h>
|
#include <vendor/lineage/touch/1.0/IKeyDisabler.h>
|
||||||
|
#include "samsung_touch.h"
|
||||||
|
|
||||||
namespace vendor {
|
namespace vendor {
|
||||||
namespace lineage {
|
namespace lineage {
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace V1_0 {
|
||||||
namespace samsung {
|
namespace samsung {
|
||||||
|
|
||||||
bool StylusMode::isSupported() {
|
bool StylusMode::isSupported() {
|
||||||
std::ifstream file("/sys/class/sec/tsp/cmd_list");
|
std::ifstream file(TSP_CMD_LIST_NODE);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
while (getline(file, line)) {
|
while (getline(file, line)) {
|
||||||
|
@ -38,7 +38,7 @@ bool StylusMode::isSupported() {
|
||||||
|
|
||||||
// Methods from ::vendor::lineage::touch::V1_0::IStylusMode follow.
|
// Methods from ::vendor::lineage::touch::V1_0::IStylusMode follow.
|
||||||
Return<bool> StylusMode::isEnabled() {
|
Return<bool> StylusMode::isEnabled() {
|
||||||
std::ifstream file("/sys/class/sec/tsp/cmd_result");
|
std::ifstream file(TSP_CMD_RESULT_NODE);
|
||||||
if (file.is_open()) {
|
if (file.is_open()) {
|
||||||
std::string line;
|
std::string line;
|
||||||
getline(file, line);
|
getline(file, line);
|
||||||
|
@ -49,7 +49,7 @@ Return<bool> StylusMode::isEnabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<bool> StylusMode::setEnabled(bool enabled) {
|
Return<bool> StylusMode::setEnabled(bool enabled) {
|
||||||
std::ofstream file("/sys/class/sec/tsp/cmd");
|
std::ofstream file(TSP_CMD_NODE);
|
||||||
file << "hover_enable," << (enabled ? "1" : "0");
|
file << "hover_enable," << (enabled ? "1" : "0");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <hidl/MQDescriptor.h>
|
#include <hidl/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
#include <vendor/lineage/touch/1.0/IStylusMode.h>
|
#include <vendor/lineage/touch/1.0/IStylusMode.h>
|
||||||
|
#include "samsung_touch.h"
|
||||||
|
|
||||||
namespace vendor {
|
namespace vendor {
|
||||||
namespace lineage {
|
namespace lineage {
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace touch {
|
||||||
namespace V1_0 {
|
namespace V1_0 {
|
||||||
namespace samsung {
|
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<int32_t, TouchscreenGesture::GestureInfo> TouchscreenGesture::kGestureInfoMap = {
|
const std::map<int32_t, TouchscreenGesture::GestureInfo> TouchscreenGesture::kGestureInfoMap = {
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <hidl/MQDescriptor.h>
|
#include <hidl/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
#include <vendor/lineage/touch/1.0/ITouchscreenGesture.h>
|
#include <vendor/lineage/touch/1.0/ITouchscreenGesture.h>
|
||||||
|
#include "samsung_touch.h"
|
||||||
|
|
||||||
namespace vendor {
|
namespace vendor {
|
||||||
namespace lineage {
|
namespace lineage {
|
||||||
|
|
39
hidl/touch/include/samsung_touch.h
Normal file
39
hidl/touch/include/samsung_touch.h
Normal file
|
@ -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
|
|
@ -27,6 +27,11 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
|
|
||||||
|
#define ANDROID_ATOMIC_INLINE
|
||||||
|
extern "C" {
|
||||||
|
#include <cutils/atomic.h>
|
||||||
|
}
|
||||||
|
|
||||||
#define INVALID_HEX_CHAR 16
|
#define INVALID_HEX_CHAR 16
|
||||||
|
|
||||||
// Enable verbose logging
|
// Enable verbose logging
|
||||||
|
|
Loading…
Reference in a new issue