I'm working on a C++ project to read button presses via GPIO pins from the Gumstix board and am running into some issues. As I understand it, there are two different ways to read GPIO lines: 1.) reading through an API, or 2.) standard filesystem commands like cat and echo. We are currently using filesystem commands.
So far, I've just been trying to read the pins on the commandline via, for example, 'cat /sys/class/gpio/gpioN' where N is the GPIO number. As I understand it, this gpio directory lists all the GPIO pins that have been 'exported' by the kernel to userspace. However, if I export other GPIOs, I can't seem to successfully read them. Is there a way to change the configuration of the kernel to make more GPIO pins available? Could the kernel be reserving certain pins for other uses so I can't actually read button presses with them? Am I just making this more complicated than it needs to be?
However, the GPIO pins listed on that chart don't match the GPIO pins that exist in /sys/class/gpio when I boot the system. For example, GPIO114 exists in the filesystem, but GPIO171 does not. If I attach a button to the pins for GPIO114, the button appears to work (gpio114/value changes between 0 and 1). I can 'echo 171 > export' to gain access to GPIO 171, but when I read the value of that pin via 'cat gpio171/value' it always stays at 0 whether the attached button is pressed or not.