Gpiod randomly creates files in filesystem

Hello everybody,

this issue could be related to

That is, after booting, random files with random names (but all of them look like output console sentences) starts to create. Let me show you an example (this is after 1 hour uptime, only blue folders should be there)

The diference with the topic I linked before is that in my case the appearence or not of those files is when using gpiod.

I made an executable "iomanager" which iterates every 3 seconds over all gpiochip (only one in this case) and all gpio pins (64 in this case) in order to store values using protobufer. This works perfectly except when I uncomment the lines where gpiod is used, in code:

struct gpiod_chip *chip;

chip = gpiod_chip_open_by_name(it.gpio_chip_name().c_str()); //Open chip
if (!chip) {
    
}
else
{
    for(GPIOShMem::GPIOShMemData::GPIO_t &it2 : *it.mutable_gpios())
    {
        if(it2.mode().compare("input") == 0)
        {
            
            struct gpiod_line *l_gpioline = gpiod_chip_get_line(chip,  it2.gpio_number());
            if(NULL != l_gpioline)
            {
                
                int32_t l_line_req = gpiod_line_request_input(l_gpioline, CONSUMER);   
                int32_t gpio_val = gpiod_line_get_value(l_gpioline);
                gpiod_line_release(l_gpioline); 
           
                //int32_t gpio_val = 0; //gpiod_ctxless_get_value(it.gpio_chip_name().c_str(), it2.gpio_number(), false, CONSUMER);
                it2.set_value(gpio_val);

                //std::this_thread::sleep_for( std::chrono::milliseconds(10));
            }
        }         
    }

    gpiod_chip_close(chip); //Close chip

Just using
struct gpiod_line *l_gpioline = gpiod_chip_get_line(chip, it2.gpio_number());
starts generating all these garbage files, even without performing the read with
int32_t l_line_req = gpiod_line_request_input(l_gpioline, CONSUMER); int32_t gpio_val = gpiod_line_get_value(l_gpioline);
ctxless functions doesnt work either. Commenting those lines, no problem happens.

I deleted all procd initialization scripts (in case there is any interference) but still happens.

Here is my procd script

#!/bin/sh /etc/rc.common

START=52
USE_PROCD=1

STOP=01
start_service() {
        procd_open_instance
        procd_set_param command /bin/iomanager -f /etc/config/iomanager_settings.yaml
        procd_set_param stdout 1
        procd_set_param stderr 1
        procd_close_instance
}

Any hints of what could be happening here?

Thanks you so much in advance

I tried tweaking some kernel paremeters regarding GPIO, my current cfg is as follows:
gpio_kernel

I tried also enabling both (sysfs & chardev), no luck.

What I'm missing? Could be something in other kernel cfg section?

Thank you! Any help would be really appreciated!

I will reply to myself.

Solution was found, was a problem of accesing some GPIOS that should be never accesed. Asumming that they were inputs or outputs if nothing specified was the wrong approach. Solution was let the system initalise them as I or O and never poll that specific GPIOS.

Hope that helps if somebody is in similar situation :slight_smile:
bye!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.