bangkk: sensors: Support both display nodes
* Depending on which display the device uses, the node path changes so modify the hal to verify which one actually exists and set it. * Goodix ts uses spi0.0 and fts uses spi0.1, so suppport both of them. Signed-off-by: BarryBlackCat <silva.tiago0910@gmail.com> Change-Id: I2d3ff57651655d5612ff355241a5933137a7bbec
This commit is contained in:
parent
d6cafd3eb9
commit
05cf5af4ea
2 changed files with 21 additions and 1 deletions
|
@ -10,6 +10,10 @@ on post-fs
|
|||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/double_tap_pressed
|
||||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/udfps_enabled
|
||||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/udfps_pressed
|
||||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/double_tap_enabled
|
||||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/double_tap_pressed
|
||||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/udfps_enabled
|
||||
chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/udfps_pressed
|
||||
|
||||
on post-fs-data
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <filesystem>
|
||||
|
||||
#include <condition_variable>
|
||||
#include <fstream>
|
||||
|
@ -120,7 +121,22 @@ class SysfsPollingOneShotSensor : public OneShotSensor {
|
|||
int mPollFd;
|
||||
};
|
||||
|
||||
const std::string kTsPath = "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/";
|
||||
inline std::string getTouchscreenBasePath() {
|
||||
const std::vector<std::string> possiblePaths = {
|
||||
"/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/",
|
||||
"/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/"
|
||||
};
|
||||
|
||||
for (const auto& path : possiblePaths) {
|
||||
if (access(path.c_str(), F_OK) == 0) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/";
|
||||
}
|
||||
|
||||
const std::string kTsPath = getTouchscreenBasePath();
|
||||
|
||||
const std::string kTsDoubleTapPressedPath = kTsPath + "double_tap_pressed";
|
||||
const std::string kTsDoubleTapEnabledPath = kTsPath + "double_tap_enabled";
|
||||
|
|
Loading…
Reference in a new issue