pstar: touch: GloveMode -> HighTouchPollingRate

This commit is contained in:
SGCMarkus 2022-03-13 15:32:03 +01:00
parent 35b2216ce6
commit 71a1c4bd06
6 changed files with 16 additions and 16 deletions

View File

@ -21,7 +21,7 @@ cc_binary {
relative_install_path: "hw", relative_install_path: "hw",
proprietary: true, proprietary: true,
srcs: [ srcs: [
"GloveMode.cpp", "HighTouchPollingRate.cpp",
"service.cpp", "service.cpp",
], ],
shared_libs: [ shared_libs: [

View File

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
#define LOG_TAG "GloveModeService" #define LOG_TAG "HighTouchPollingRateService"
#include "GloveMode.h" #include "HighTouchPollingRate.h"
#include <fstream> #include <fstream>
@ -28,7 +28,7 @@ namespace implementation {
const std::string kInterpolationPath = "/sys/class/touchscreen/primary/interpolation"; const std::string kInterpolationPath = "/sys/class/touchscreen/primary/interpolation";
Return<bool> GloveMode::isEnabled() { Return<bool> HighTouchPollingRate::isEnabled() {
std::ifstream file(kInterpolationPath); std::ifstream file(kInterpolationPath);
int enabled; int enabled;
file >> enabled; file >> enabled;
@ -39,7 +39,7 @@ Return<bool> GloveMode::isEnabled() {
return false; return false;
} }
Return<bool> GloveMode::setEnabled(bool enabled) { Return<bool> HighTouchPollingRate::setEnabled(bool enabled) {
std::ofstream file(kInterpolationPath); std::ofstream file(kInterpolationPath);
file << (enabled ? "1" : "0"); file << (enabled ? "1" : "0");
return !file.fail(); return !file.fail();

View File

@ -16,7 +16,7 @@
#pragma once #pragma once
#include <vendor/lineage/touch/1.0/IGloveMode.h> #include <vendor/lineage/touch/1.0/IHighTouchPollingRate.h>
namespace vendor { namespace vendor {
namespace lineage { namespace lineage {
@ -26,9 +26,9 @@ namespace implementation {
using ::android::hardware::Return; using ::android::hardware::Return;
class GloveMode : public IGloveMode { class HighTouchPollingRate : public IHighTouchPollingRate {
public: public:
// Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow. // Methods from ::vendor::lineage::touch::V1_0::IHighTouchPollingRate follow.
Return<bool> isEnabled() override; Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enabled) override; Return<bool> setEnabled(bool enabled) override;
}; };

View File

@ -19,18 +19,18 @@
#include <android-base/logging.h> #include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h> #include <hidl/HidlTransportSupport.h>
#include "GloveMode.h" #include "HighTouchPollingRate.h"
using ::vendor::lineage::touch::V1_0::IGloveMode; using ::vendor::lineage::touch::V1_0::IHighTouchPollingRate;
using ::vendor::lineage::touch::V1_0::implementation::GloveMode; using ::vendor::lineage::touch::V1_0::implementation::HighTouchPollingRate;
int main() { int main() {
android::sp<IGloveMode> gloveMode = new GloveMode(); android::sp<IHighTouchPollingRate> highTouchPollingRate = new HighTouchPollingRate();
android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/); android::hardware::configureRpcThreadpool(1, true /*callerWillJoin*/);
if (gloveMode->registerAsService() != android::OK) { if (highTouchPollingRate->registerAsService() != android::OK) {
LOG(ERROR) << "Cannot register touchscreen glove HAL service."; LOG(ERROR) << "Cannot register touchscreen high polling rate HAL service.";
return 1; return 1;
} }

View File

@ -1,5 +1,5 @@
service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.pstar service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.pstar
interface vendor.lineage.touch@1.0::IGloveMode default interface vendor.lineage.touch@1.0::IHighTouchPollingRate default
class hal class hal
user system user system
group system group system

View File

@ -4,7 +4,7 @@
<transport>hwbinder</transport> <transport>hwbinder</transport>
<version>1.0</version> <version>1.0</version>
<interface> <interface>
<name>IGloveMode</name> <name>IHighTouchPollingRate</name>
<instance>default</instance> <instance>default</instance>
</interface> </interface>
</hal> </hal>