I want to know what all are the available GPIO pins are available to use. I need to send the intermediate response of available GPIO pins for the test and read mode AT commands of AT+KGPIOCFG for WP85 series from my legato application. I tried to read the /sys/class/gpio/export but there is no content inside this file.
char result[1000];
FILE *fp = NULL;
int i;
char c;
fp = fopen("/sys/class/gpio/export", "r");
if (!fp)
{
LE_INFO("Error opening file %s for reading.\n", "/sys/class/gpio/export");
return;
}
else
{
LE_INFO("Opening file %s for reading is successful.\n", "/sys/class/gpio/export");
return;
}
i = 0;
while (((c = fgetc(fp)) != EOF) && (i < (sizeof(result) - 1)))
{
result[i] = c;
i++;
}
result[i] = '\0';
fclose (fp);
LE_INFO("Read result: %s from %s", result, "/sys/class/gpio/export");
Is this correct way of fetching available pins? Any legato GPIO services or method is available to get these values?