This was an issue on the google code tracker, but I don't see it here.
Further, using
:::python
def cb(pin):
state = GPIO.input(pin)
to try to ascertain the state, seems to produce uncertain results (at least in my setup...)
For example; using an arcade button wired to connect ground to GPIO 23 when closed and using the PUD_UP option, I can generally see that GPIO.input(23) is 1 when the button is open, and 0 when the button is closed. OK.
Using the GPIO.BOTH callback with a bouncetime of around 5ms, I only get one callback on press, and one callback on release. OK.
However, if I try to get the state as noted above, on both press and release the state always seems to be '1' as if the button was open. If I re-read the input after a print statement (introducing some delay), the state reads as expected;
:::python
def cb2(pin):
state = GPIO.input(pin)
print "This is the wrong state: %s" % state
state = GPIO.input(pin)
print "This is the right state: %s" % state
GPIO.add_event_detect(23, GPIO.BOTH, callback=cb2, bouncetime=5)
I am not sure what the uncertainty is in reading the pins, but the callbacks are getting called when I want -- it'd be very nice if the callback just told you which event actually triggered it.
I would also very much like this feature added. I believe there would be a race condition otherwise. I looked at migrating to the similar RPIO library which has this feature however it appears that that library has been discontinued.
The fix will be done in conjunction with work on issue 121. I need to think how I can handle the edge type being returned to the callback function without breaking eveyone's existing code.