Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpio incorrectly assumes 0 value by default #34

Closed
neojski opened this issue Dec 9, 2014 · 4 comments
Closed

gpio incorrectly assumes 0 value by default #34

neojski opened this issue Dec 9, 2014 · 4 comments

Comments

@neojski
Copy link

neojski commented Dec 9, 2014

In set there's comparison of current value with the new one. But current value is not read from hardware but assumed to be 0 by default. Therefore if gpio is high I cannot make it back low.

@cinderblock
Copy link

This is not exactly a bug with this GpiO package. The linux sysfs gpio interface specifies that the output starts as low unless the direction is set to high instead of out. See #38 for more.

@mmajchrzycki
Copy link

I confirm that it is a bug, especially for inputs. If we have an input with pull-up enabled, the default state is '1', but the library returns 0 as long as there was no transition on that input.
So, at least here:
https://github.com/EnotionZ/GpiO/blob/master/lib/gpio.js#L104
you have to manually read the value and store it. The same situation is for output because you have no guarantee that something before your applications, changed the output value.

@rzr
Copy link
Collaborator

rzr commented Jul 4, 2018

@mmajchrzycki please confirm linked patch is working.
I have to do similar fixes app's side so I thought this can be done internally with:

TizenTeam@2a6df58#diff-7185c21331efab29ab056d18eee6d632R117

@EnotionZ
Copy link
Owner

EnotionZ commented Oct 1, 2018

The patch was already merged into master. Tests are in #58 and will be merged into v1 branch. Closing issue.

@EnotionZ EnotionZ closed this as completed Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants