Writing value is not permitted when the pin is in input direction mode.
Just in case, this patch fixes error number and adds log message to let user
know the cause.
Change-Id: Ie40fabeba06b832eaa0585130af8702ba8fcb8b5
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
peripheral_bus_gpio_s *gpio = &handle->dev.gpio;
int ret;
- /* Return error if direction is input mode */
- if (gpio->direction == GPIO_DIRECTION_IN)
- return PERIPHERAL_ERROR_IO_ERROR;
+ /* Return error if direction of the pin is input mode */
+ if (gpio->direction == GPIO_DIRECTION_IN) {
+ _E("The direction of the pin is INPUT mode, Cannot write");
+ return PERIPHERAL_ERROR_INVALID_OPERATION;
+ }
if ((ret = gpio_write(gpio->pin, value)) < 0) {
_E("gpio_write error (%d)", ret);