diff options
author | John Klug <john.klug@multitech.com> | 2023-11-02 17:31:36 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2023-11-02 18:13:00 -0500 |
commit | ced9991aafb6b1b30649fd34b0d17399686d4843 (patch) | |
tree | a9c9ab947271966843be4ac6f157b292f5a5e28b | |
parent | 40a09c25bf1dd08db8b526b274c2f24c22458206 (diff) | |
download | mts-io-sysfs-ced9991aafb6b1b30649fd34b0d17399686d4843.tar.gz mts-io-sysfs-ced9991aafb6b1b30649fd34b0d17399686d4843.tar.bz2 mts-io-sysfs-ced9991aafb6b1b30649fd34b0d17399686d4843.zip |
Remove libgpiod 1.x version from mts-io-sysfs
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | include/Device/Device.h | 1 | ||||
-rw-r--r-- | src/Device/Device.cpp | 53 |
3 files changed, 1 insertions, 55 deletions
@@ -35,7 +35,7 @@ CFLAGS += -Werror -Wno-unused-function CXXFLAGS += -std=c++14 -Wno-unused-function -LIBS := -lmts -lrt -lssl -lcrypto -lgpiod +LIBS := -lmts -lrt -lssl -lcrypto INC=-Iinclude -Iinclude/Utility -Iinclude/AccessoryCards -Iinclude/Device -Iinclude/Fpga INCLUDES = $(wildcard include/*.h) diff --git a/include/Device/Device.h b/include/Device/Device.h index 3f367bb..7a20f04 100644 --- a/include/Device/Device.h +++ b/include/Device/Device.h @@ -7,7 +7,6 @@ #include "Version.h" #include <math.h> /* ceil */ -#define CMDNAME "mts-io-sysfs" class Mtac15Fpga; class Device { diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp index 3f7cf27..feb763d 100644 --- a/src/Device/Device.cpp +++ b/src/Device/Device.cpp @@ -15,7 +15,6 @@ * ***********************************************************************/ -#include <gpiod.h> #include "Device.h" const std::vector<std::string> Device::apIdentifiers = { @@ -495,34 +494,8 @@ void Device::printUsage(std::string program) { exitHandler(0); } -/* If the name starts in upper case, assume - * the name is a GPIO line name from gpio-hog - * in device tree. If it starts in lower case - * assume the name is an attribute of the mts-io - * driver. GPIOs can only be zero - * or one, never a text string. - */ void Device::show(std::string name) { std::string fileData; - char chipname[64]; - unsigned int offset; - int retval; - - if(isupper(name[0])) { - retval = gpiod_ctxless_find_line(name.c_str(), chipname, - sizeof chipname,&offset); - if(retval != -1) - retval = gpiod_ctxless_get_value(chipname, offset, - false, CMDNAME); - if(retval != -1) { - if(retval == 0) - printf("0\n"); - else - printf("1\n"); - exitHandler(0); - } - } - int32_t code = MTS::System::readFile(SYSFS_PLATFORM + name, fileData); if (code == 0) { printf("%s", fileData.c_str()); @@ -546,38 +519,12 @@ void Device::showTrigger(std::string name) { exitHandler(99); } -// Prefer gpiod if name starts with upper case and is value 0 or 1 void Device::store(std::string name, std::string value) { - int intvalue = -1; - int prefergpiod = 0; - char chipname[64]; - unsigned int offset; - int retval; - if (!isRoot) { printError("Must be root to store to %s", name.c_str()); exitHandler(99); } printDebug("Setting %s to %s", name.c_str(), value.c_str()); - if(isupper(name[0])) { - if (value.compare("0") == 0) - intvalue = 0; - if (value.compare("1") == 0) - intvalue = 1; - if ((intvalue != -1)) - prefergpiod = 1; - } - - if(prefergpiod) { - retval = gpiod_ctxless_find_line(name.c_str(), chipname, - sizeof chipname,&offset); - if(retval != -1) - retval = gpiod_ctxless_set_value(chipname, offset, intvalue, - false, CMDNAME, NULL, NULL); - if(retval != -1) - exitHandler(0); - } - std::ofstream fileToWrite(SYSFS_PLATFORM + name); if (fileToWrite.is_open()) { fileToWrite << value; |