October 2017
Intermediate to advanced
586 pages
14h 8m
English
Apart from using the /sys/class/gpio/export file to export a GPIO to the user space, you can use functions such as gpio_export (for legacy interfaces) or gpioD_export (the new interface) from the kernel code in order to explicitly manage exporting the GPIOs that have already been requested using gpio_request() or gpiod_get():
int gpio_export(unsigned gpio, bool direction_may_change); int gpiod_export(struct gpio_desc *desc, bool direction_may_change);
The direction_may_change parameter decides whether you can change the signal direction from input to output and vice versa. The reverse operations from the kernel are gpio_unexport() or gpiod_unexport():
void gpio_unexport(unsigned gpio); /* Integer-based interface ...
Read now
Unlock full access