-
Notifications
You must be signed in to change notification settings - Fork 115
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
Unhandled permission error leads to [Error: Pin has not been exported] #41
Comments
It turns out it was a "permission denied" error comming from the method setEdge. Since the error wasn't being handled on the "setup" function the next block wasn't being executed and i also didn't realise the problem. Actually the library just failed silently, when logging the error i got
the solution was to run my script with "sudo" or give the right permissions to my user |
Thanks for the report and for the solution. I think there are two issues here:
|
@JamesBarwell thanks a lot for your library and for your input. i wish i had done a pull request instead of simply opening a issue. the problem is that i'm quite new to dealing with gpio so i'm backtracked on my project trying to figure out some of my application problems first - apologises about that. Also, on a similar subject, if you don't mind me asking here: I'm trying to figure out is how to read encoders, i have seem some examples using C and it seems they read a "stream" that comes from the encoder.. I'm not sure how we could make this happen using the "read" function here? I tried to read as fast as possible, but it didn't seem to be right way of doing? Perhaps for encoders and other sort of inputs we could somehow integrate with node.js streams making some sort of "socket connection" to the gpio ? And last but not least, i believe perhaps we should replace using async for something like bluebird Promises ? I believe it would make it easier to handle the errors and also to read the source code. Again, thank you very very much for putting this together. Hopefully i'll figure my stuff out soon and get back with some pull requests instead of feature requests! |
I'd be interested in streaming input, but I'm afraid it's not something I have much knowledge of at the moment, nor will I have any time to look at. This module really just wraps the existing GPIO filesystem functions, so it may be a bit out of scope. There was a request to use promises in: #34. I'm not ruling it out but it's not the route I want to go down at the moment. The API could definitely be improved, but I am still keen to stick to the style of the node.js API at present. |
Hi. Is there any update on this topic? |
I've only done a little reading on this so I'm prepared to be convinced otherwise, but from what I can see root permissions are required to write to the filesystem for these pins. This module is really just a wrapper for those filesystem operations so it's not within scope of this module to try and work around it. I don't think this module should be involved in messing around with file permissions or user groups, etc. So at the moment my thinking is that it's up to the user of this module to either compartmentalise their application appropriately, so that only some of it is running with root permissions, and/or do something with the sudoers file to restrict what can get run. There's a blog post along similar lines here: http://www.mobilewill.us/2012/07/raspberry-pi-and-gpio-permissions.html |
@JamesBarwell thank you for the reply. I was just wondering if you have solution for that. |
@JamesBarwell / @alexandrbig i'm pretty sure you don't need to be root, just google it and you will find! unfortunately i don't have the link as reference right now |
I think I found the root cause for this. Wrote it up in #48 . |
There's a new version |
I am using 0.8.1 and still having this issue on my Pi 3B. I am doing something wrong? |
@PiyushRamuka Could you raise a new issue and include the code you're using + all the details of the error please. |
@JamesBarwell - created one. Thanks! |
I'm trying to setup/read using this library but i'm getting "Pin has not been exported" error, here is my code:
here is the error:
if i manually export and try to read via gpio it works //=
rPi 2, model B
The text was updated successfully, but these errors were encountered: