Package org.emrick.project
Class BoardDriverInstaller
java.lang.Object
org.emrick.project.BoardDriverInstaller
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final recordprivate static final recordprivate static final recordprivate static enumprivate static final record -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleancommandShowsDevice(List<String> command) private static voidprivate static PathdownloadAndExtract(String url, String folderName, Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) private static StringescapeForPowerShell(String value) private static PathfindFirstMatching(Path root, Predicate<Path> predicate) static voidinstallBoardDriver(JFrame owner, HardwareStatusIndicator hardwareStatusIndicator, Consumer<String> sysMsgWriter) private static voidinstallLinuxDriver(Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) private static voidinstallMacDriver(Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) private static voidinstallWindowsDriver(Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) private static StringjoinOutput(BoardDriverInstaller.CommandResult... results) private static IOExceptionmanualInstallNeeded(IOException cause) The automatic download didn't work (no internet, or the server refused it), so send the user to the Silicon Labs driver page, which only allows downloads from a web browser.private static BoardDriverInstaller.DeviceProbeprivate static StringreadOutput(InputStream inputStream) private static voidrefreshHardwareIndicator(HardwareStatusIndicator hardwareStatusIndicator) private static BoardDriverInstaller.CommandResultrunCommand(List<String> command) private static Stringprivate static Stringprivate static voidsleep(long millis) private static voidprivate static BoardDriverInstaller.DeviceProbewaitForDevice(BoardDriverInstaller.OperatingSystem os, Duration timeout, Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer)
-
Field Details
-
WINDOWS_DRIVER_URL
- See Also:
-
WINDOWS_DRIVER_SHA256
- See Also:
-
MAC_DRIVER_URL
- See Also:
-
DRIVER_INFO_URL
- See Also:
-
POST_INSTALL_VERIFY_TIMEOUT
-
-
Constructor Details
-
BoardDriverInstaller
private BoardDriverInstaller()
-
-
Method Details
-
installBoardDriver
public static void installBoardDriver(JFrame owner, HardwareStatusIndicator hardwareStatusIndicator, Consumer<String> sysMsgWriter) -
waitForDevice
private static BoardDriverInstaller.DeviceProbe waitForDevice(BoardDriverInstaller.OperatingSystem os, Duration timeout, Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) -
installWindowsDriver
private static void installWindowsDriver(Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
installMacDriver
private static void installMacDriver(Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
installLinuxDriver
private static void installLinuxDriver(Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
probeForDevice
private static BoardDriverInstaller.DeviceProbe probeForDevice(BoardDriverInstaller.OperatingSystem os) -
commandShowsDevice
-
findCp210SerialPorts
-
downloadAndExtract
private static Path downloadAndExtract(String url, String folderName, Consumer<BoardDriverInstaller.ProgressUpdate> progressConsumer) throws IOException - Throws:
IOException
-
download
- Throws:
IOException
-
sha256
- Throws:
IOException
-
manualInstallNeeded
The automatic download didn't work (no internet, or the server refused it), so send the user to the Silicon Labs driver page, which only allows downloads from a web browser. -
unzip
- Throws:
IOException
-
findFirstMatching
- Throws:
IOException
-
runCommand
private static BoardDriverInstaller.CommandResult runCommand(List<String> command) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
readOutput
- Throws:
IOException
-
refreshHardwareIndicator
-
sleep
private static void sleep(long millis) -
safe
-
escapeForPowerShell
-
joinOutput
-