diff --git a/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/internal/GpioDContext.java b/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/internal/GpioDContext.java index 4a0f3f07..52522998 100644 --- a/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/internal/GpioDContext.java +++ b/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/internal/GpioDContext.java @@ -1,6 +1,5 @@ package com.pi4j.library.gpiod.internal; -import com.pi4j.boardinfo.definition.BoardModel; import com.pi4j.boardinfo.util.BoardInfoHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,7 +35,7 @@ public GpioDContext() { } public synchronized void initialize() { - if (BoardInfoHelper.current().getBoardModel() == BoardModel.UNKNOWN) { + if (!BoardInfoHelper.runningOnRaspberryPi()) { logger.warn("Can't initialize GpioD context, board model is unknown"); return; } diff --git a/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/util/NativeLibraryLoader.java b/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/util/NativeLibraryLoader.java index 1b473f63..86e90d0c 100644 --- a/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/util/NativeLibraryLoader.java +++ b/libraries/pi4j-library-gpiod/src/main/java/com/pi4j/library/gpiod/util/NativeLibraryLoader.java @@ -26,7 +26,6 @@ * #L% */ -import com.pi4j.boardinfo.definition.BoardModel; import com.pi4j.boardinfo.util.BoardInfoHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -256,7 +255,7 @@ public static void loadLibraryFromClasspath(String path) throws IOException { } // Finally, load the library - if (BoardInfoHelper.current().getBoardModel() == BoardModel.UNKNOWN) { + if (!BoardInfoHelper.runningOnRaspberryPi()) { logger.warn("Can't load the library, board model is unknown"); } else { System.load(target.toAbsolutePath().toString()); diff --git a/pi4j-core/src/main/java/com/pi4j/boardinfo/util/BoardInfoHelper.java b/pi4j-core/src/main/java/com/pi4j/boardinfo/util/BoardInfoHelper.java index bc291f42..0aa1065a 100644 --- a/pi4j-core/src/main/java/com/pi4j/boardinfo/util/BoardInfoHelper.java +++ b/pi4j-core/src/main/java/com/pi4j/boardinfo/util/BoardInfoHelper.java @@ -64,6 +64,10 @@ public static boolean usesRP1() { return instance.boardInfo.getBoardModel() == BoardModel.MODEL_5_B; } + public static boolean runningOnRaspberryPi() { + return instance.boardInfo.getBoardModel() != BoardModel.UNKNOWN; + } + public static boolean is32bit() { return !is64bit(); }