From: Nikita Shubin Date: Thu, 13 Mar 2025 08:13:13 +0000 (+0300) Subject: core: allow guse created gpiochip X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=refs%2Fheads%2Fnshubin%2Fguse-fix;p=qemu-gpiodev%2Flibgpiod.git core: allow guse created gpiochip Add this to check if device was created via guse and allow it. Signed-off-by: Nikita Shubin --- diff --git a/lib/internal.c b/lib/internal.c index 56cb8b9..546ab3c 100644 --- a/lib/internal.c +++ b/lib/internal.c @@ -63,13 +63,14 @@ bool gpiod_check_gpiochip_device(const char *path, bool set_errno) * perfectly normal when resolving paths), errno is not cleared. */ errno = 0; - - if (strcmp(sysfsp, "/sys/bus/gpio") != 0) { - /* This is a character device but not the one we're after. */ - errno = ENODEV; - goto out_free_sysfsp; - } - + if (strcmp(sysfsp, "/sys/class/guse") == 0) + goto out_ok; + else if (strcmp(sysfsp, "/sys/bus/gpio") == 0) + goto out_ok; + + errno = ENODEV; + goto out_free_sysfsp; +out_ok: ret = true; out_free_sysfsp: