diff --git a/app/src/main/cpp/GPIOControl.cpp b/app/src/main/cpp/GPIOControl.cpp index 783025af..3bba8be7 100644 --- a/app/src/main/cpp/GPIOControl.cpp +++ b/app/src/main/cpp/GPIOControl.cpp @@ -43,7 +43,7 @@ typedef struct{ void GpioControl::setInt(int cmd, int value) { - int fd = open("/dev/mtkgpioctrl", O_RDONLY); + int fd = open(GPIO_NODE_MP, O_RDONLY); IOT_PARAM param; param.cmd = cmd; param.value = value; @@ -59,7 +59,7 @@ void GpioControl::setInt(int cmd, int value) int GpioControl::getInt(int cmd) { - int fd = open("/dev/mtkgpioctrl", O_RDONLY); + int fd = open(GPIO_NODE_MP, O_RDONLY); // LOGE("get_int fd=%d,cmd=%d\r\n",fd, cmd); if( fd > 0 ) { @@ -77,7 +77,7 @@ int GpioControl::getInt(int cmd) void GpioControl::setLong(int cmd, long value) { - int fd = open("/dev/mtkgpioctrl", O_RDONLY); + int fd = open(GPIO_NODE_MP, O_RDONLY); IOT_PARAM param; param.cmd = cmd; param.value2 = value; @@ -93,7 +93,7 @@ void GpioControl::setLong(int cmd, long value) long GpioControl::getLong(int cmd) { - int fd = open("/dev/mtkgpioctrl", O_RDONLY); + int fd = open(GPIO_NODE_MP, O_RDONLY); // LOGE("get_long fd=%d,cmd=%d\r\n",fd, cmd); if( fd > 0 ) { @@ -110,8 +110,7 @@ long GpioControl::getLong(int cmd) void GpioControl::setString(int cmd, const std::string& value) { IOT_PARAM param; - // char *pval = jstringToChars(env, value); - int fd = open("/dev/mtkgpioctrl", O_RDONLY); + int fd = open(GPIO_NODE_MP, O_RDONLY); int len = MAX_STRING_LEN < value.size() ? MAX_STRING_LEN : value.size(); param.cmd = cmd; @@ -129,7 +128,7 @@ void GpioControl::setString(int cmd, const std::string& value) std::string GpioControl::getString(int cmd) { - int fd = open("/dev/mtkgpioctrl", O_RDONLY); + int fd = open(GPIO_NODE_MP, O_RDONLY); // LOGE("get_string fd=%d,cmd=%d\r\n",fd, cmd); if( fd > 0 ) { diff --git a/app/src/main/cpp/GPIOControl.h b/app/src/main/cpp/GPIOControl.h index 70339636..e7090c20 100644 --- a/app/src/main/cpp/GPIOControl.h +++ b/app/src/main/cpp/GPIOControl.h @@ -48,6 +48,9 @@ #define CMD_SET_485_en4 305 +#define GPIO_NODE_MP "/dev/mtkgpioctrl" +#define GPIO_NODE_N938 "/sys/devices/platform/1000b000.pinctrl/mt_gpio" + class GpioControl { public: