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

Fix permissions error for /sys/class/gpio/export #32

Open
wants to merge 2 commits into
base: python-2.7
Choose a base branch
from

Conversation

Gadgetoid
Copy link
Collaborator

Replaces first part of #26

@Gadgetoid
Copy link
Collaborator Author

Note: This is targeting a new legacy Python 2.7 branch to keep track of any backported fixes from 2.x.x to 1.x.x.

FMODE = "w+" # w+ overwrites and truncates existing files
FMODE_SYS_WO = "w" # /sys/class/gpio/export is not readable, even by root
FMODE_SYS_RW = "w+" # w+ overwrites and truncates existing files
FMODE_BIN_RW = "wb+" # Using unbuffered binary IO is ~ 3x faster than text
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using w+ at all then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a good question - it’s a legacy thing that it never occurred to me to question. My assumption was something like a truncating write was needed to change the direction successfully, and I can’t recall if I tried anything different.

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

Successfully merging this pull request may close these issues.

3 participants