in reply to Re: Running specific test files with sudo
in thread Running specific test files with sudo

Cheers, haukex.

Problem is with these two pieces of functionality (PWM and direct mods to the hardware clock), that doesn't work, as they can't use /dev/gpiomem, as they aren't directly related to the GPIO itself, and function outside of that scope.

I'm still looking for some form of workaround. All other functionality thus far works fine the way you state, as I'm just dealing with GPIO directly.

update: That said, if you happen to come across any C/Python/<insert lang> code that operates on either of these (PWM is *far* more common) without requiring root access, I would hugely appreciate a reply or private message, so that I can review the code and see how they are doing it. I know some libraries (particularly Python) that secretly use sudo, but nothing (ie. docs/changelog, CLI notice etc) mentions this. I outright refuse to do this, as it opens potential security holes and isn't fair to the end-user. I'd sooner have the Pi crash hard, then, when I get emails, I can say "RTFM for X and Y again" ;) (well not really, but if sudo is secretly used in one place, who knows where else it is used).

I did have some of my code doing this in the extreme early stages of this project, but it felt dirty and I backed it all out. This was at the time that /dev/gpiomem wasn't standard, and *all* code paths to the GPIO required root.

Now that those restrictions have been lifted/integrated into the OS by default (newer Raspbian OS cuts), there's no need for this less specific non-GPIO-direct functionality.