Restricting GPIOS to output-only or input-only through sysfs

386 Views Asked by At

I am using Ubuntu 11.10. I have written a driver for a GPIO chip which did not have its own driver in the kernel.

I want to place a restriction on users from setting output-only pins to inputs, and vice-versa when using /sys/class/gpio. This is because many of the GPIO's on my board are input only or output only.

I could scan for restricted GPIO numbers from within the functions gpio_direction_in(), gpio_direction_out() and gpio_request() but I think that's a bit of a hack-around.

Is there any function especially for this purpose? I looked through the documentation for GPIOs but I couldn't see anything.

  • Andrew
0

There are 0 best solutions below