Hi,
I am doing testing on GPIO of AR7550.
By following this page:
https://forum.sierrawireless.com/t/ar7-board-gpio-support/11974/1
I can read the GPIO state via /sys/class/gpio/gpio10/value
However, when i try to access this directory inside legato application,
[code] LE_INFO(“Enter init_gpio”);
if (le_dir_IsDir("/sys/class/gpio/gpio10"))
{
LE_DEBUG(“Gpio already initialized”);
return;
}
int fd;
int value;
fd = open("/sys/class/gpio/gpio10/direction", O_WRONLY);
if (fd < 0)
{
LE_DEBUG("Failed to open gpio10 direction\n");
return;
}
else
{
LE_DEBUG("gpio10 direction opened\n");
}
write(fd, "in",2);
close(fd);
fd = open("/sys/class/gpio/gpio10/value", O_RDONLY);
if (fd < 0)
{
LE_DEBUG("Failed to open gpio10 value\n");
return;
}
else
{
LE_DEBUG("gpio10 value opened\n");
}
read(fd, &value,sizeof(int));
close(fd);
LE_DEBUG("gpio10 value = %d\n",value);[/code]
It always returns “Failed to open gpio10 value”.
Do you know why?