@@ -211,4 +211,16 @@ config UCFWHANDLER
comment "Microcontroller handler depends on libgpiod"
depends on !HAVE_LIBGPIOD
+config UCFW_OLD_LIBGPIOD
+ bool "Support older libgpiod version"
+ depends on HAVE_LIBGPIOD
+ depends on UCFWHANDLER
+ default n
+ help
+ The libgpiod library changed the api gpiod_line_request_output.
+ The old function was replaced by gpiod_line_request_flags_output
+ while the new one dropped "flags" from the list of parameters.
+ Rather there is no way to get this changes from the library
+ at build time.
+
endmenu
@@ -139,13 +139,21 @@ static int switch_mode(char *devreset, int resoffset, char *devprog, int progoff
goto freegpios;
}
+#ifdef CONFIG_UCFW_OLD_LIBGPIOD
status = gpiod_line_request_output(linereset, RESET_CONSUMER, false, 0);
+#else
+ status = gpiod_line_request_output(linereset, RESET_CONSUMER, 0);
+#endif
if (status) {
ret =-ENODEV;
ERROR("Cannot request reset line");
goto freegpios;
}
+#ifdef CONFIG_UCFW_OLD_LIBGPIOD
status = gpiod_line_request_output(lineprog, PROG_CONSUMER, false, mode);
+#else
+ status = gpiod_line_request_output(lineprog, PROG_CONSUMER, mode);
+#endif
if (status) {
ret =-ENODEV;
ERROR("Cannot request prog line");
libgpiod changed API, but there is no way to get the version at build time. gpiod_line_request_output() was replaced by by gpiod_line_request_flags_output() while gpiod_line_request_output() does not have the flags parameter anymore (not used by the handler). A compiler flag in SWUpdate is added to handle different versions of the library. Signed-off-by: Stefano Babic <sbabic@denx.de> --- handlers/Config.in | 12 ++++++++++++ handlers/ucfw_handler.c | 8 ++++++++ 2 files changed, 20 insertions(+)