summaryrefslogtreecommitdiff
path: root/src/Device
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2023-11-02 17:31:36 -0500
committerJohn Klug <john.klug@multitech.com>2023-11-02 18:13:00 -0500
commitced9991aafb6b1b30649fd34b0d17399686d4843 (patch)
treea9c9ab947271966843be4ac6f157b292f5a5e28b /src/Device
parent40a09c25bf1dd08db8b526b274c2f24c22458206 (diff)
downloadmts-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
Diffstat (limited to 'src/Device')
-rw-r--r--src/Device/Device.cpp53
1 files changed, 0 insertions, 53 deletions
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;