2. Run it.
3. Note the output continuously scrolls "No Edge Received".
**Expected behavior**
The program should have blocked until the button was pressed.
**Platform (please complete the following information):**
- OS: Raspbian Bookworm
- Board: Pi 4 B 4GB
- Kernel: 6.6.16-v8+
**Additional context**
The program has been working for several years. After a kernel update, it stopped working. Experimentation shows that reading the state of the button does work.
I've searched around, and found some references that this might be related to deprecation of /sys/class/gpio?
FWIW, I tried python and RPi.GPIO and it sees the button press as well, but attempt to add event for edge detection fails.
I tried running my test program under strace and got:
Dang, sorry to hear. I fear someone will have to do the migration. Since the driver is in host, not in conn, it's tracked at https://github.com/periph/host/issues/39.
Describe the bug Using the specified kernel, a call go WaitForEdge immediately unblocks and returns.
To Reproduce Steps to reproduce the behavior:
import ( "log" "periph.io/x/conn/v3/driver/driverreg" "periph.io/x/conn/v3/gpio" "periph.io/x/conn/v3/gpio/gpioreg" "periph.io/x/host/v3" )
func main() { , err:=host.Init() if err!=nil { panic(err) } , err = driverreg.Init() if err!=nil { panic(err) } pin := gpioreg.ByName("GPIO19") pin.In(gpio.PullUp, gpio.BothEdges) for { edgeReceived := pin.WaitForEdge(-1) if edgeReceived { log.Print("Edge Received., State=", pin.Read()) } else { log.Print("No Edge Received") } } }
... futex(0x200d00, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 futex(0x200d00, FUTEX_WAIT_PRIVATE, 0, NULL) = -1 EAGAIN (Resource temporarily unavailable) nanosleep({tv_sec=0, tv_nsec=3000}, NULL) = 0 futex(0x4000100148, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x4000100148, FUTEX_WAKE_PRIVATE, 1) = 1 newfstatat(AT_FDCWD, "/sys/bus/platform/drivers/raspberrypi-firmware", {st_mode=S_IFDIR|0755, st_size=0, ...}, 0) = 0 openat(AT_FDCWD, "/proc/device-tree/system/linux,revision", O_RDONLY|O_CLOEXEC) = 7 fcntl(7, F_GETFL) = 0x20000 (flags O_RDONLY|O_LARGEFILE) fcntl(7, F_SETFL, O_RDONLY|O_NONBLOCK|O_LARGEFILE) = 0 epoll_ctl(4, EPOLL_CTL_ADD, 7, {events=EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, data={u32=223870981, u64=35813851309539333}}) = 0 fstat(7, {st_mode=S_IFREG|0444, st_size=4, ...}) = 0 read(7, "\0\3001\22", 512) = 4 read(7, "", 508) = 0 epoll_ctl(4, EPOLL_CTL_DEL, 7, 0x4000064c80) = 0 close(7) = 0 futex(0x4000080148, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x4000100148, FUTEX_WAKE_PRIVATE, 1) = 1 openat(AT_FDCWD, "/etc/localtime", O_RDONLY) = 7 read(7, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\6\0\0\0\0"..., 4096) = 2460 read(7, "", 4096) = 0 close(7) = 0 write(2, "2024/02/12 12:44:38 No Edge Rece"..., 372024/02/12 12:44:38 No Edge Received ) = 37 futex(0x4000100148, FUTEX_WAKE_PRIVATE, 1) = 1 futex(0x200d00, FUTEX_WAIT_PRIVATE, 0, NULL) = 0 2024/02/12 12:44:39 No Edge Received