Question about gpio sysfs interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a question regarding user-space gpio support with sysfs.

Documentation/gpio/sysfs.txt states
> GPIO signals have paths like /sys/class/gpio/gpio42/ (for GPIO #42)
> and have the following read/write attributes:
>
>    /sys/class/gpio/gpioN/
>
>	"direction" ... reads as either "in" or "out". This value may
>		normally be written. ...
>
>		Note that this attribute *will not exist* if the kernel
>		doesn't support changing the direction of a GPIO, or
>		it was exported by kernel code that didn't explicitly
>		allow userspace to reconfigure this GPIO's direction.

Imagine for example a generic user-space tool which enumerates
all available GPIOs to the user and sorts by input and output GPIOs.
How would such a tool classify an exported GPIO when kernel
doesn't export the 'direction' file via sysfs? Or in other words: how
can userspace detect the state (in vs. out) of a GPIO when 'direction'
is not exported?

I propose to change the API that direction is always exported, but
is only readable when hardware doesn't support changing the
direction and/or kernel code wants to prohibit this.

Best regards,
Michael

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux