After enabling the GPIO device support in kernel device driver (Kernel verion 3.10.92) I wanted to read the value of an input pin of my GPIO expander through GPIO sysfs. After exporting and setting the direction
as in
, on reading, the value
is always given as 0
even after the event is happening which will change the pin value
as 1
. While the output direction is working fine i.e. I am able to glow a LED by altering the value
as 0
or 1
.
Base address for my GPIO expander in GPIO sysfs is 184. So, to read the pin number 22 i.e. pin number 206 according to GPIO sysfs, the commands I gave in kernel are
echo 206 > /sys/class/gpio/exportecho "in" > /sys/class/gpio/gpio206/directioncat /sys/class/gpio/gpio206/value # always gives the value as 0
I am using PCA9505 GPIO expander (40 I/O pins) which is connected to MPC8308 microprocessor and controlled through mpc I2C bus.