Skip to content

gpioioctl.GPIOLine.WaitForEdge() infinite-timeout disparity #78

Description

@gkuchta

Describe the bug
I'm not necessarily sure if this is a bug, but gpioioctl uses WaitForEdge(0) to mean "wait forever", while the rest of the packages use -1. WaitForEdge() works correctly according to its own source-level documentation, but its at odds with the rest of the packages which use -1 to mean "wait forever." Using WaitForEdge(-1) with gpioioctl will cause it to immediately return false.

https://github.com/periph/host/blame/main/gpioioctl/gpio.go#L239

I think this line could just be changed to if timeout < 1, but I didn't want to presume it was a bug if this was completely intentional.

Additional context
The 0 value seems confusing based on prior issues like periph/conn#40 which say that gpioioctl is the solution to the most-likely sysfs-related issues in the past, but the submitted code in that issue would still "be broken" with the gpioioctl implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions