From 834fd8e50ce01193908da7740ecd820dcdeba3f9 Mon Sep 17 00:00:00 2001 From: Nikita Shubin Date: Thu, 13 Mar 2025 11:13:13 +0300 Subject: [PATCH] core: allow guse created gpiochip Add this to check if device was created via guse and allow it. Signed-off-by: Nikita Shubin --- lib/internal.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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: -- 2.30.2