linux: Raise an error if configuring a pullup when that is not supported

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-04-25 11:30:13 -04:00
parent 3dadcd3614
commit 70ea0806d9
1 changed files with 3 additions and 0 deletions

View File

@ -153,6 +153,9 @@ gpio_in_reset(struct gpio_in g, int8_t pull_up)
} else if (pull_up < 0) { } else if (pull_up < 0) {
req.flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN; req.flags |= GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN;
} }
#else
if (pull_up)
shutdown("Linux gpio interface does not support pullup/pulldown");
#endif #endif
req.lineoffsets[0] = g.line->offset; req.lineoffsets[0] = g.line->offset;
strncpy(req.consumer_label, GPIO_CONSUMER, sizeof(req.consumer_label) - 1); strncpy(req.consumer_label, GPIO_CONSUMER, sizeof(req.consumer_label) - 1);