well, if you need only reading by router from these GPIOs, I guess it is the easiest. Just read continuously:
PHP Code:
cat /dev/gpio/in 
then change the state of the pins and see the changes in the value obtained and try to figure out which bit is which.

To write to /dev/gpio/out you should provide first a bit mask in /dev/gpio/outen