Skip to content

Commit

Permalink
core: remove buggy flags sanitization from line-config
Browse files Browse the repository at this point in the history
We try to drop potentially set output flags from line config if edge
detection is enabled but we use the library enum instead of the one from
the uAPI. In any case, we should actually loudly complain if user tries
to use the output mode with edge-detection (like we do currently) so just
remove offending lines entirely.

Reported-by: Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
  • Loading branch information
Bartosz Golaszewski committed Jan 5, 2024
1 parent b07d076 commit 8e2e30e
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/line-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,18 +381,15 @@ static uint64_t make_kernel_flags(struct gpiod_line_settings *settings)
case GPIOD_LINE_EDGE_FALLING:
flags |= (GPIO_V2_LINE_FLAG_EDGE_FALLING |
GPIO_V2_LINE_FLAG_INPUT);
flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
break;
case GPIOD_LINE_EDGE_RISING:
flags |= (GPIO_V2_LINE_FLAG_EDGE_RISING |
GPIO_V2_LINE_FLAG_INPUT);
flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
break;
case GPIOD_LINE_EDGE_BOTH:
flags |= (GPIO_V2_LINE_FLAG_EDGE_FALLING |
GPIO_V2_LINE_FLAG_EDGE_RISING |
GPIO_V2_LINE_FLAG_INPUT);
flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
break;
default:
break;
Expand Down

0 comments on commit 8e2e30e

Please sign in to comment.