diff --git a/Source/Meadow.CLI/Commands/Current/Firmware/FirmwareWriteCommand.cs b/Source/Meadow.CLI/Commands/Current/Firmware/FirmwareWriteCommand.cs index a1490a2a..6fe89c49 100644 --- a/Source/Meadow.CLI/Commands/Current/Firmware/FirmwareWriteCommand.cs +++ b/Source/Meadow.CLI/Commands/Current/Firmware/FirmwareWriteCommand.cs @@ -33,6 +33,8 @@ public class FirmwareWriteCommand : BaseDeviceCommand private FileManager FileManager { get; } private ISettingsManager Settings { get; } + private string DFU_USB_ERROR_MESSAGE = "Operation not supported or unimplemented on this platform"; + public FirmwareWriteCommand(ISettingsManager settingsManager, FileManager fileManager, MeadowConnectionManager connectionManager, ILoggerFactory loggerFactory) : base(connectionManager, loggerFactory) { @@ -181,7 +183,22 @@ protected override async ValueTask ExecuteCommand() // do we have a dfu device attached, or is DFU specified? var provider = new LibUsbProvider(); - var dfuDevice = GetLibUsbDeviceForCurrentEnvironment(provider); + + ILibUsbDevice? dfuDevice = null; + + try + { + dfuDevice = GetLibUsbDeviceForCurrentEnvironment(provider); + } + catch (Exception ex) + { + if (ex.Message.Contains(DFU_USB_ERROR_MESSAGE)) + { + var msg = "Exception: " + ex.Message + Environment.NewLine + Environment.NewLine + Strings.DfuUsbErrorMessage; + throw new CommandException(msg, ex); + } + } + bool ignoreSerial = IgnoreSerialNumberForDfu(provider); if (dfuDevice != null) diff --git a/Source/Meadow.CLI/Meadow.CLI.csproj b/Source/Meadow.CLI/Meadow.CLI.csproj index 15172167..d65936dd 100644 --- a/Source/Meadow.CLI/Meadow.CLI.csproj +++ b/Source/Meadow.CLI/Meadow.CLI.csproj @@ -10,7 +10,7 @@ Wilderness Labs, Inc Wilderness Labs, Inc true - 2.0.66.0 + 2.0.67.0 AnyCPU http://developer.wildernesslabs.co/Meadow/Meadow.CLI/ https://github.com/WildernessLabs/Meadow.CLI diff --git a/Source/Meadow.CLI/Properties/AssemblyInfo.cs b/Source/Meadow.CLI/Properties/AssemblyInfo.cs index 49850bde..e66de821 100644 --- a/Source/Meadow.CLI/Properties/AssemblyInfo.cs +++ b/Source/Meadow.CLI/Properties/AssemblyInfo.cs @@ -6,5 +6,5 @@ namespace Meadow.CLI; public static class Constants { - public const string CLI_VERSION = "2.0.66.0"; + public const string CLI_VERSION = "2.0.67.0"; } \ No newline at end of file diff --git a/Source/Meadow.CLI/Strings.cs b/Source/Meadow.CLI/Strings.cs index 43dbfc18..620c54da 100644 --- a/Source/Meadow.CLI/Strings.cs +++ b/Source/Meadow.CLI/Strings.cs @@ -1,7 +1,4 @@ -using Meadow.Telemetry; -using Spectre.Console; - -namespace Meadow.CLI; +namespace Meadow.CLI; public static class Strings { @@ -71,8 +68,9 @@ public static class Strings public const string AppDeployFailed = "Application deploy failed"; public const string AppDeployedSuccessfully = "Application deployed successfully"; public const string AppTrimFailed = "Application trimming failed"; - public const string WithConfiguration = "with configuration"; - public const string At = "at"; + public const string WithConfiguration = "with configuration"; + public const string At = "at"; + public const string DfuUsbErrorMessage = "Found a DFU device but couldn't identify it as Meadow hardware. \r\nEnsure your device is in DFU mode and is correctly recognized by the host development machine."; public static class Telemetry {