Topic: Fonera 2100 and GPIO

Hi,

I have installed OpenWRT following this tutorial: http://wiki.openwrt.org/toh/fon/fonera
It's working, I have configured the network and several other things, but I can't get GPIO working. All the tutorials I have found on The Internet use /proc/gpio to deal with GPIO pins, but I have no gpio dir under /proc.

How can I get GPIO working? Do I have to recompile the kernel? (I hope I have not to compile everything).

Re: Fonera 2100 and GPIO

/dev/gpio

3 (edited by doragasu 2012-02-03 19:49:22)

Re: Fonera 2100 and GPIO

I have /dev/gpio, but not /proc/gpio. All tutorials I have read use /proc/gpio. How can I use /dev/gpio. Do I neet to install a package? Will one of these help?:

gpioctl_1.0-1_mips.ipk
kmod-input-gpio-buttons_2.6.26.8-atheros-1_mips.ipk
kmod-leds-gpio_2.6.26.8-atheros-1_mips.ipk

Re: Fonera 2100 and GPIO

I have found the way to control pins using gpioctl. For example to ligth WLAN led:

gpioctl dirout 2
gpioctl set 2

Anyway, if anyone knows how to use the more convenient /proc/gpio way, or even how to do it in plain C, please post it here.

Re: Fonera 2100 and GPIO

Yes you can use /dev/gpio using c.

Re: Fonera 2100 and GPIO

    if ((gpio_bus = open("/dev/gpio", O_RDWR)) < 0)
    {
         printf("/dev/gpio open Failure\n");
    }
    else
    {
        ioctl(gpio_bus, GPIO_DIR_OUT, gpionumber);
    }

ioctl(gpio_bus, GPIO_CLEAR, gpionumber);

ioctl(gpio_bus, GPIO_SET, gpionumber);

Re: Fonera 2100 and GPIO

Thanks a lot! Nice and easy!

Re: Fonera 2100 and GPIO

Let me know if you have any more questions, though that's pretty much the sum total about GPIOs.