From 3045be31ff4b02e7aec95e29bb5f5d8714af17d1 Mon Sep 17 00:00:00 2001 From: Xo Wang Date: Fri, 2 Dec 2016 10:47:43 -0800 Subject: pytools/gpioutil: Strip whitespace from value read Reading from the value file includes a newline following the value, so strip it. Signed-off-by: Xo Wang Change-Id: I075794d80f6db0ad8169c6a142ea56b34bd87164 --- pytools/gpioutil | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pytools') diff --git a/pytools/gpioutil b/pytools/gpioutil index 5ed13e2..6589060 100644 --- a/pytools/gpioutil +++ b/pytools/gpioutil @@ -73,7 +73,7 @@ class Gpio: raise Exception("ERROR - Invalid value: "+value) def getValue(self): - return self.read(self.getPath('value')) + return self.read(self.getPath('value')) def write(self,path,data): f = open(path,'w') @@ -83,7 +83,7 @@ class Gpio: def read(self,path): f = open(path,'r') - data = f.readline() + data = f.readline().strip() f.close() return data -- cgit v1.2.1