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

gpioCfgGetInternals and gpioCfgSetInternals do not return PI_INITIALISED if it has already been initialised #455

Open
berndporr opened this issue Apr 10, 2021 · 1 comment

Comments

@berndporr
Copy link

According to the documentation
https://github.com/joan2937/pigpio/blob/master/pigpio.h#L107
all gpioCfg functions return PI_INITIALISED after gpioInitialise() has been called but neither gpioCfgGetInternals nor gpioCfgSetInternals do it:
https://github.com/joan2937/pigpio/blob/master/pigpio.c#L14019
gpioCfgGetInternals cannot return an error code as it returns an unsigned int.
gpioCfgSetInternals just returns always zero.
Perhaps just the doc could be updated or gpioCfgSetInternals could return an error if called after gpioInitialise?

@guymcswain
Copy link
Collaborator

Your suggestions seem reasonable to me. Changing the API to match the doc is preferred as in this case nobody else appears to be using the return value.

A pull request is welcome with these expectations: If accepted I will merge to the develop branch as soon as I get around to it but it won't make it into master until the next release. I'm trying to limit releases to once or twice per year unless a critical issue comes up. If you pull from develop you'll be getting the latest version of pigpio. I've been pretty conservative by only placing changes in develop that are tested and on track for the next release.

berndporr added a commit to berndporr/pigpio that referenced this issue Apr 10, 2021
This resolves joan2937#455 with the discussion with @guymcswain that
gpioCfgSetInternals() should return an error if gpioInitialise()
has been called previously to report that it's no longer possible,
for example, to disable signal handling. If successful it returns
0 as before. Tested it by calling gpioCfgSetInternals, gpioInitialise,
gpioCfgSetInternals and reports 0 and -32 which looks OK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants