linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Reading current output value
@ 2022-06-22  7:54 Yegor Yefremov
  2022-06-22 10:26 ` Kent Gibson
  0 siblings, 1 reply; 8+ messages in thread
From: Yegor Yefremov @ 2022-06-22  7:54 UTC (permalink / raw)
  To: Linux GPIO List; +Cc: brgl

On a am335x based board I have a GPIO pin that enables/disables power
of an external device (the bootloader sets this pin to output and 1,
and the kernel is instructed to not change it). Using kernel
5.19.0-rc2 and sysfs interface, I can read the current status as
follows:

echo 68 > /sys/class/gpio/export
cat /sys/class/gpio/gpio68/value

As a result, I read 1.

Using gpioget (libgpiod) v1.6.3, the line will be configured to
"input" and the value is set to 0:

# gpioget 2 4
0

So, how can I read the state without changing it? I am mostly
interested in using the kernel userspace API directly.

By the way, setting pin to 0 works but not to 1:

gpioset 2 4=0 - OK
gpioset 2 4=1 - no level change

sysfs works.

Regards,
Yegor

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-29  8:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22  7:54 Reading current output value Yegor Yefremov
2022-06-22 10:26 ` Kent Gibson
2022-06-22 10:56   ` Andy Shevchenko
2022-06-27 10:37   ` Yegor Yefremov
2022-06-28  4:52     ` Kent Gibson
2022-06-29  2:14       ` Kent Gibson
2022-06-29  7:50         ` Yegor Yefremov
2022-06-29  8:20           ` Kent Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).