-
Notifications
You must be signed in to change notification settings - Fork 165
sysfs-gpio: assert WaitForEdge() and Halt() work as expected #323
Comments
Hi, quick heads up: The code snippet below produces the following results (on Pi0w):
The GPIO out parts (GPIO23,24,25) could be safely ignored, but I kept them, as I mostly test with headless setup and help of LED indicators. Additionally I noticed, that ones the parent process is suspended and resumed (f.e. with CTRL+Z on Linux bash terminal), the As mentioned on twitter, toggling the internal pull resistor between PullUp and PullDown could be (mis)used from software side to "force release" a pending |
Add up: The syscall.EpollWait returns an event which has EPOLLERR set beginning from the second call (event[0].Events == 10). If the value file is opened with |
Ok so I enabled gpiosmoketest to run on the gohci beaglebone worker, and I created https://github.com/google/periph/commits/gpiotest to test this behavior. I hope I covered most cases there, but this gives a good test bed, making it easy to add more. |
Filed #326 for the signal part. Let's focus on normal behavior here, then signals can be looked at afterward |
Make it run on beaglebone via gohci. The test intentionally expects failure as described in #323.
I have done a bunch of tests, to find a way to interrupt To summarize: It isn't possible (at least not in a clean way)! Possible solutions
So from my point of view the best solution would be to implement the looping method.
Please understand that I can't file a PR, as neither solution seems clean to me and for my own use case I'm still fine with the idea of calling epoll_wait with I hope you gonna find a valid fix. The code snippet from above should at least avoid the failing tests, without impacting other functionality. |
I think implementing the signal method is better than looping; yes this opens the door to having WaitForEdge() return false spuriously, but it's not a big deal. |
Another (promising) solution in the PR Edit: So if you consider the idea valid, I'd be happy to see it implemented, as I need to move on with my own project (where this problem is already solved by another hack) |
Add a short description for each worker. Running the GPIO smoke test on a Raspberry Pi will be helpful; up to now it only ran on a BeagleBone Green Wireless, which doesn't have a CPU specific GPIO driver. So this enables smoke testing a new code path. This should help with issue #323.
Enabled GPIO smoke test on RPi as part of the continuous testing: Code is at: |
Any reason not to create another FD with |
I have no idea, I'm not super familiar with linux's events (I'm a Windows guy). |
I'm making real progress on a permanent fix for this. I'm now able to run a much stricter version of gpiosmoketest in a continous loop locally, testing that all of Halt(), In() and Out() can cancel a pending WaitForEdge(). |
This is going to be fixed via #380. |
The text was updated successfully, but these errors were encountered: