From d78ad91635b4d24d09674e9706eff3a5f710396e Mon Sep 17 00:00:00 2001 From: Nicola Lunghi Date: Thu, 7 Sep 2017 17:39:07 +0100 Subject: [PATCH] src/x86/up.c: Require kernel FPGA control abort the loading of mraa if the up kernel module is not loaded Signed-off-by: Nicola Lunghi Signed-off-by: Brendan Le Foll --- src/x86/up.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/x86/up.c b/src/x86/up.c index 0617379..8152d51 100644 --- a/src/x86/up.c +++ b/src/x86/up.c @@ -223,7 +223,13 @@ mraa_up_board() b->adc_raw = 8; b->adc_supported = 8; - return b; + const char* pinctrl_path = "/sys/bus/platform/drivers/up-pinctrl"; + int have_pinctrl = access(pinctrl_path, F_OK) != -1; + syslog(LOG_NOTICE, "up: kernel pinctrl driver %savailable", have_pinctrl ? "" : "un"); + + if (have_pinctrl) + return b; + error: syslog(LOG_CRIT, "up: Platform failed to initialise"); free(b);