-
Notifications
You must be signed in to change notification settings - Fork 123
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
Writing to an input pin results in permissions errors #167
Comments
@rtimmons Thank you for filing this issue. I think there are two issues here. The first issues is distinguishing between
Unfortunately, the distinction between these two errors is quit subtle and it's relatively easy to mistakenly interpret an The second issue is that although it may not make sense to write to an input on a Raspberry Pi it may make sense on other systems. onoff was implemented to work on any Linux system and not only the Raspberry Pi. Whether or not writing to an input makes sense is something that the operating system and device drivers will need to decide. It's not something that I want try to determine in onoff. For example, writing to an input on an AVR microcontroller is a valid operation and is used to enable the pull-up resistor on that input. I realize that this isn't a particularly good example as Linux doesn't run on AVR microcontrollers. Although your feature request will make sense in 99.9% of cases, I'm afraid that I won't add it to onoff. I want the operating system and device drivers to decide which operations make sense. |
Thank you for the detailed response, @fivdi. I had never considered the distinction between While I respect your decision to not work around this, at the very least it would be helpful to point out somewhere, perhaps in method-level documentation, that -Cheers for a good rest of your Sunday- |
Yes, documenting this at method-level for
Yes, that would be great. |
Fixed with c73b473 |
Hi there thank you for your work on this project - it has made my smarthome integration projects significantly easier.
I ran into some trouble earlier with permissions when I mistakenly tried to call
write
to a pin that I had marked asinput
:I'm guessing this is due to how raspbian's procfs models input vs output pins.
While this is clearly user-error, the error message was very inscrutible and I wasted more time than I care to admit debugging it 😄
Would you be amenable to me sending a PR that would error out (or warn) if the user tries to call
write
on aGpio
instance that was marked asinput
rather thanoutput
? I believe this would be a quick change, but I wanted to run it by you prior to spending the time to write and test it.A "cleaner" solution may be to have distinct
GpioInput
andGpioOutput
that don't have the methods that don't make sense.This is obviously a bigger change, but it is something to consider.
Thank you for your time.
The text was updated successfully, but these errors were encountered: