Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve output when flashing with a missing USB driver or bad connection/cable #619

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class FirmwareWriteCommand : BaseDeviceCommand<FirmwareWriteCommand>
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)
{
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Source/Meadow.CLI/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Authors>Wilderness Labs, Inc</Authors>
<Company>Wilderness Labs, Inc</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.66.0</PackageVersion>
<PackageVersion>2.0.67.0</PackageVersion>
<Platforms>AnyCPU</Platforms>
<PackageProjectUrl>http://developer.wildernesslabs.co/Meadow/Meadow.CLI/</PackageProjectUrl>
<RepositoryUrl>https://github.com/WildernessLabs/Meadow.CLI</RepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Source/Meadow.CLI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
10 changes: 4 additions & 6 deletions Source/Meadow.CLI/Strings.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using Meadow.Telemetry;
using Spectre.Console;

namespace Meadow.CLI;
namespace Meadow.CLI;

public static class Strings
{
Expand Down Expand Up @@ -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
{
Expand Down
Loading