I am using an Adafruit Ft232H breakout to add GPIO ports to my Linux pc. Although I had some success to flash a led with libftdi and bitbang mode, I don't have the same luck with libgpiod because gpiod_line_request_output is failing.
Some gpio information of my system:
sudo gpiodetect
gpiochip0 [ftdi-cbus] (4 lines)
sudo gpioinfo
gpiochip0 - 4 lines:
        line   0:      unnamed       unused   input  active-high 
        line   1:      unnamed       unused   input  active-high 
        line   2:      unnamed       unused   input  active-high 
        line   3:      unnamed       unused   input  active-high
This is the C program which tries to access the line 0.
#include <stdio.h>
#include <stdlib.h>
#include <gpiod.h>
#define LINE_NUM 0
void gpio_fatal(struct gpiod_chip* chip, const char msg[20]);
int main(int argc, char** argv)
{
    struct gpiod_chip*  chip;
    struct gpiod_line*  line;
    const char path[] = "/dev/gpiochip0";
    chip = gpiod_chip_open(path);
    if(!chip)
    {
        fprintf(stderr, "Error opening path\n");
        return EXIT_FAILURE;
    }
    line = gpiod_chip_get_line(chip, LINE_NUM);
    if(!line)
    {
        fprintf(stderr, "error getting this line\n");
        return EXIT_FAILURE;
    }
    int ret = gpiod_line_request_output(line,
                        "ftdi-cbus",
                        1);
    if(ret != 0)
        gpio_fatal(chip, "Request output failed");
    for(;;)
    {
        gpiod_line_set_value(line, 1);
        printf("On\n");
        sleep(1);
        gpiod_line_set_value(line, 0);
        printf("Off\n");
        sleep(1);
    }
    gpiod_line_release(line);
    gpiod_chip_close(chip);
    return EXIT_SUCCESS;
}
void gpio_fatal(struct gpiod_chip* chip, const char* msg)
{
    fprintf(stderr, "%s\n", msg);
    gpiod_chip_close(chip);
    exit(EXIT_FAILURE);
}
Running the executable with sudo gives me:
sudo g_gpiod/build/g_gpiod 
Password: 
Request output failed
gpiod.h states for the failing function the following:
/**
 * @brief Reserve a single line, set the direction to output.
 * @param line GPIO line object.
 * @param consumer Name of the consumer.
 * @param default_val Initial line value.
 * @return 0 if the line was properly reserved, -1 on failure.
 */
int gpiod_line_request_output(struct gpiod_line *line,
                  const char *consumer, int default_val) GPIOD_API;
The parameters seem to be correct, for what reason could this be failing? Other examples using libftdi or CircuitPython can access the ports and work correctly.
 
    