From 3241670f8d08b961fef170676677a5a236fc05f0 Mon Sep 17 00:00:00 2001 From: Dominique Louis Date: Thu, 15 Jun 2023 08:46:05 +0200 Subject: [PATCH 1/8] Format VS4M release tag to new format. (#313) * Format VS4M relase tag, to new format. * Bump to node 16, as earlier versions won't be supported after summer. --- .github/workflows/dotnet.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 4a6ba09a..8170a95e 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,6 +2,8 @@ name: Meadow.CLI env: TOOLS_RELEASE_VERSION: 1.0.2.2 MEADOW_OS_VERSION: 1.0.2.0 + VS_MAC_2019_VERSION: 8.10 + VS_MAC_2022_VERSION: 17.5 on: push: @@ -313,7 +315,7 @@ jobs: with: owner: WildernessLabs repo: VS_Mac_Meadow_Extension - tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}.VS2019 + tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2019_VERSION }} release_name: VS Mac VS2019 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} body: | ${{ steps.commit_messages.outputs.result }} @@ -421,7 +423,7 @@ jobs: with: owner: WildernessLabs repo: VS_Mac_Meadow_Extension - tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}.VS2022 + tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2022_VERSION }} release_name: VS Mac VS2022 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} body: | ${{ steps.commit_messages.outputs.result }} @@ -478,10 +480,10 @@ jobs: - name: Setup Nuget uses: Nuget/setup-nuget@v1.0.5 - - name: Setup Node.js 14 + - name: Setup Node.js 16 uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Install NPM run: | From aa6ec06b598a56a60083ca075039f5e998c8bd24 Mon Sep 17 00:00:00 2001 From: Chris Tacke Date: Thu, 15 Jun 2023 01:49:01 -0500 Subject: [PATCH 2/8] make windows port name case-insensitive (#312) --- Meadow.CLI/Commands/MeadowSerialCommand.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Meadow.CLI/Commands/MeadowSerialCommand.cs b/Meadow.CLI/Commands/MeadowSerialCommand.cs index 11ea31a9..4b43df4f 100644 --- a/Meadow.CLI/Commands/MeadowSerialCommand.cs +++ b/Meadow.CLI/Commands/MeadowSerialCommand.cs @@ -56,6 +56,12 @@ private string GetSerialPort() private bool PortExists(string name) { + if (OperatingSystem.IsWindows()) + { + // windows is case-insensitive + return System.IO.Ports.SerialPort.GetPortNames().Contains(name, StringComparer.InvariantCultureIgnoreCase); + } + return System.IO.Ports.SerialPort.GetPortNames().Contains(name); } From 5c84fb9c33f8e8ab8d4922411616130e8362e5ad Mon Sep 17 00:00:00 2001 From: Dominique Louis Date: Wed, 28 Jun 2023 17:59:16 +0100 Subject: [PATCH 3/8] =?UTF-8?q?Revert=20"Revert=20"Revert=20"Changes=20to?= =?UTF-8?q?=20pass=20developer=20level=20to=20the=20device=E2=80=A6=20(#31?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Reverts commit 6b40d43ed351fece244d830e01af075f1e067239. * Bump CLI to 1.0.4.0 * Modify CI to Create specific version on manual trigger. * Add version number to artefacts, so we know what we're downloading. --- .github/workflows/dotnet.yml | 53 ++++++++++--------- Meadow.CLI.Core/Constants.cs | 2 +- Meadow.CLI.Core/Devices/IMeadowDevice.cs | 5 +- Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs | 19 ++++++- .../Devices/MeadowLocalDevice.FileManager.cs | 2 +- Meadow.CLI.Core/Devices/MeadowLocalDevice.cs | 35 ++++++++++-- .../Internals/MeadowCommunication/Command.cs | 9 ++-- .../MeadowCommunication/FileCommand.cs | 2 +- .../SimpleCommandBuilder.cs | 10 +--- Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj | 2 +- Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj | 2 +- Meadow.CLI.Core/Meadow.CLI.Core.csproj | 2 +- .../Trace/SetDeveloperValueCommand.cs | 22 ++++---- Meadow.CLI/Meadow.CLI.csproj | 2 +- Meadow.Hcom/HcomMeadowRequestType.cs | 7 +-- 15 files changed, 108 insertions(+), 66 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 8170a95e..0d494e22 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,6 +1,7 @@ name: Meadow.CLI env: - TOOLS_RELEASE_VERSION: 1.0.2.2 + TOOLS_RELEASE_VERSION: 1.0.4.0 + SHORT_TOOLS_RELEASE_VERSION: 1.0.4 MEADOW_OS_VERSION: 1.0.2.0 VS_MAC_2019_VERSION: 8.10 VS_MAC_2022_VERSION: 17.5 @@ -35,7 +36,7 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.5 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update CLI Version Numbers run: | $content = Get-Content main/Meadow.CLI/Meadow.CLI.csproj | Out-String @@ -70,7 +71,7 @@ jobs: - name: Upload nuget Artifacts for internal testing uses: actions/upload-artifact@v2 with: - name: Meadow.CLI.nuget + name: Meadow.CLI.nuget.${{ ENV.TOOLS_RELEASE_VERSION }} path: 'main\**\Meadow.CLI\bin\Release\*.nupkg' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -119,11 +120,11 @@ jobs: - name: Add MSBuild to Path uses: microsoft/setup-msbuild@v1.1 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2019 Version Numbers run: | $content = Get-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2019/source.extension.vsixmanifest | Out-String - $newcontent = $content -replace 'Version="0.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' + $newcontent = $content -replace 'Version="1.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' $newcontent | Set-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2019/source.extension.vsixmanifest - name: Restore VS2019 dependencies @@ -138,7 +139,7 @@ jobs: - name: Upload VS2019 VSIX Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Win.VS2019.vsix + name: Meadow.Win.VS2019.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-win\VS_Meadow_Extension\VS_Meadow_Extension.2019\bin\Release\*.vsix' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -188,11 +189,11 @@ jobs: with: vs-version: '[17.0, 18.0)' - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2022 Version Numbers run: | $content = Get-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2022/source.extension.vsixmanifest | Out-String - $newcontent = $content -replace 'Version="0.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' + $newcontent = $content -replace 'Version="1.*" Language="en-US" Publisher="Wilderness Labs"', 'Version="${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}" Language="en-US" Publisher="Wilderness Labs"' $newcontent | Set-Content vs-win/VS_Meadow_Extension/VS_Meadow_Extension.2022/source.extension.vsixmanifest - name: Restore VS2022 dependencies @@ -206,7 +207,7 @@ jobs: - name: Upload VS2022 VSIX Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Win.VS2022.vsix + name: Meadow.Win.VS2022.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-win\VS_Meadow_Extension\VS_Meadow_Extension.2022\bin\Release\*.vsix' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -262,10 +263,10 @@ jobs: mv "/Applications/Visual Studio.app" "/Applications/Visual Studio 2022.app" mv "/Applications/Visual Studio 2019.app" "/Applications/Visual Studio.app" - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2019 Version Numbers run: | - sed -i "" "s/Version = \"0.*\"/Version = \"${{ENV.TOOLS_RELEASE_VERSION}}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs + sed -i "" "s/Version = \"1.*\"/Version = \"${{ENV.SHORT_TOOLS_RELEASE_VERSION}}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.cs - name: Restore our VS2019 project run: | @@ -278,7 +279,7 @@ jobs: - name: Upload Mac VS2019 mpack Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Mac.2019.mpack + name: Meadow.Mac.2019.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-mac/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -315,8 +316,8 @@ jobs: with: owner: WildernessLabs repo: VS_Mac_Meadow_Extension - tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2019_VERSION }} - release_name: VS Mac VS2019 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} + tag_name: v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2019_VERSION }} + release_name: VS Mac VS2019 Extension v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} body: | ${{ steps.commit_messages.outputs.result }} draft: true @@ -325,13 +326,13 @@ jobs: # - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} #- name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.2 + # uses: actions/upload-release-asset@v1.0.4 # env: # GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }} # with: # upload_url: ${{ steps.create_release.outputs.upload_url }} # asset_path: vs-mac/VS4Mac_Meadow_Extension/bin/Release/net472/*.mpack - # asset_name: Meadow.Mac.2019.mpack + # asset_name: Meadow.Mac.2019.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} # asset_content_type: application/zip build-vsmac-2022: @@ -370,10 +371,10 @@ jobs: - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.5 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VS2022 Version Numbers run: | - sed -i "" "s/Version = \"0.*\"/Version = \"${{ ENV.TOOLS_RELEASE_VERSION }}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.2022.cs + sed -i "" "s/Version = \"1.*\"/Version = \"${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}\"/" vs-mac/VS4Mac_Meadow_Extension/Properties/AddinInfo.2022.cs - name: Restore our VS2022 project run: | @@ -386,7 +387,7 @@ jobs: - name: Upload VS2022 mpack Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.Mac.2022.mpack + name: Meadow.Mac.2022.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-mac/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} @@ -423,8 +424,8 @@ jobs: with: owner: WildernessLabs repo: VS_Mac_Meadow_Extension - tag_name: v${{ ENV.TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2022_VERSION }} - release_name: VS Mac VS2022 Extension v${{ ENV.TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} + tag_name: v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }}-vsm${{ ENV.VS_MAC_2022_VERSION }} + release_name: VS Mac VS2022 Extension v${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} for Meadow OS v${{ ENV.MEADOW_OS_VERSION }} body: | ${{ steps.commit_messages.outputs.result }} draft: true @@ -433,13 +434,13 @@ jobs: # - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} #- name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.2 + # uses: actions/upload-release-asset@v1.0.4 # env: # GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }} # with: # upload_url: ${{ steps.create_release.outputs.upload_url }} # asset_path: vs-mac/VS4Mac_Meadow_Extension/bin/Release/net7.0/*.mpack - # asset_name: Meadow.Mac.2022.mpack + # asset_name: Meadow.Mac.2022.mpack.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} # asset_content_type: application/zip build-vscode: @@ -498,11 +499,11 @@ jobs: - name: Add MSBuild to Path uses: microsoft/setup-msbuild@v1.1 - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.event_name == 'workflow_dispatch' }} name: Update VSCode Version Numbers run: | $content = Get-Content vs-code/package.json | Out-String - $newcontent = $content -replace '"version": "0.*",', '"version": "${{ENV.TOOLS_RELEASE_VERSION}}",' + $newcontent = $content -replace '"version": "1.*",', '"version": "${{ENV.SHORT_TOOLS_RELEASE_VERSION}}",' $newcontent | Set-Content vs-code/package.json - name: Restore VSCode Extension dependencies @@ -534,7 +535,7 @@ jobs: - name: Upload VSIX Artifacts uses: actions/upload-artifact@v2 with: - name: Meadow.VSCode.vsix + name: Meadow.VSCode.vsix.${{ ENV.SHORT_TOOLS_RELEASE_VERSION }} path: 'vs-code/*.vsix' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} diff --git a/Meadow.CLI.Core/Constants.cs b/Meadow.CLI.Core/Constants.cs index d5c87d4d..aad2ff3e 100644 --- a/Meadow.CLI.Core/Constants.cs +++ b/Meadow.CLI.Core/Constants.cs @@ -7,7 +7,7 @@ namespace Meadow.CLI.Core { public static class Constants { - public const string CLI_VERSION = "1.0.2.2"; + public const string CLI_VERSION = "1.0.4.0"; public const ushort HCOM_PROTOCOL_PREVIOUS_VERSION_NUMBER = 0x0006; public const ushort HCOM_PROTOCOL_CURRENT_VERSION_NUMBER = 0x0007; // Used for transmission public const string WILDERNESS_LABS_USB_VID = "2E6A"; diff --git a/Meadow.CLI.Core/Devices/IMeadowDevice.cs b/Meadow.CLI.Core/Devices/IMeadowDevice.cs index 105a8240..a7aac8c7 100644 --- a/Meadow.CLI.Core/Devices/IMeadowDevice.cs +++ b/Meadow.CLI.Core/Devices/IMeadowDevice.cs @@ -39,7 +39,10 @@ public interface IMeadowDevice : IDisposable public Task NshDisable(CancellationToken cancellationToken = default); public Task TraceEnable(CancellationToken cancellationToken = default); public Task SetTraceLevel(uint traceLevel, CancellationToken cancellationToken = default); - public Task SetDeveloper(ushort mode, uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default); + public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default); public Task Uart1Apps(CancellationToken cancellationToken = default); public Task Uart1Trace(CancellationToken cancellationToken = default); public Task TraceDisable(CancellationToken cancellationToken = default); diff --git a/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs b/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs index 434515da..8cc6d7fa 100644 --- a/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs +++ b/Meadow.CLI.Core/Devices/MeadowDeviceHelper.cs @@ -213,9 +213,24 @@ public Task TraceDisable(CancellationToken cancellationToken = default) return _meadowDevice.TraceDisable(cancellationToken); } - public Task SetDeveloper(ushort level, uint userData, CancellationToken cancellationToken = default) + public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default) { - return _meadowDevice.SetDeveloper(level, userData, cancellationToken); + return _meadowDevice.SetDeveloper1(userData, cancellationToken); + } + + public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default) + { + return _meadowDevice.SetDeveloper2(userData, cancellationToken); + } + + public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default) + { + return _meadowDevice.SetDeveloper3(userData, cancellationToken); + } + + public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default) + { + return _meadowDevice.SetDeveloper4(userData, cancellationToken); } public Task Uart1Apps(CancellationToken cancellationToken = default) diff --git a/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs b/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs index 01da0693..75e16750 100644 --- a/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs +++ b/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs @@ -43,7 +43,7 @@ public async Task> GetFilesAndFolders( } }; - var command = new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_GET_FILES_AND_FOLDERS) + var command = new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_4) .WithResponseHandler(handler) .Build(); diff --git a/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs b/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs index 6734ae69..8fe7f0f3 100644 --- a/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs +++ b/Meadow.CLI.Core/Devices/MeadowLocalDevice.cs @@ -233,11 +233,40 @@ public Task SetTraceLevel(uint traceLevel, CancellationToken cancellationToken = return SendCommand(command, cancellationToken); } - public Task SetDeveloper(ushort level, uint userData, CancellationToken cancellationToken = default) + public Task SetDeveloper1(uint userData, CancellationToken cancellationToken = default) { var command = - new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER) - .WithDeveloperLevel(level) + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_1) + .WithUserData(userData) + .Build(); + + return SendCommand(command, cancellationToken); + } + + public Task SetDeveloper2(uint userData, CancellationToken cancellationToken = default) + { + var command = + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_2) + .WithUserData(userData) + .Build(); + + return SendCommand(command, cancellationToken); + } + + public Task SetDeveloper3(uint userData, CancellationToken cancellationToken = default) + { + var command = + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_3) + .WithUserData(userData) + .Build(); + + return SendCommand(command, cancellationToken); + } + + public Task SetDeveloper4(uint userData, CancellationToken cancellationToken = default) + { + var command = + new SimpleCommandBuilder(HcomMeadowRequestType.HCOM_MDOW_REQUEST_DEVELOPER_4) .WithUserData(userData) .Build(); diff --git a/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs b/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs index 8e9d6b83..ab653be3 100644 --- a/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs +++ b/Meadow.CLI.Core/Internals/MeadowCommunication/Command.cs @@ -8,14 +8,14 @@ public class Command { private protected const int HcomProtocolCommandRequiredHeaderLength = 12; private protected const int HcomProtocolCommandSeqNumber = 0; - // TODO No longer required? private protected const ushort HcomProtocolExtraDataDefaultValue = 0x0000; + private protected const ushort HcomProtocolExtraDataDefaultValue = 0x0000; private protected const int HcomProtocolRequestMd5HashLength = 32; static internal ushort HcomProtocolCommunicationVersion = Constants.HCOM_PROTOCOL_CURRENT_VERSION_NUMBER; public Command(HcomMeadowRequestType requestType, TimeSpan timeout, - ushort developerLevel, uint userData, + byte[]? data, Predicate responsePredicate, Predicate completionPredicate, EventHandler? responseHandler, @@ -24,8 +24,8 @@ public Command(HcomMeadowRequestType requestType, { RequestType = requestType; Timeout = timeout; - DeveloperLevel = developerLevel; UserData = userData; + Data = data; ResponsePredicate = responsePredicate; CompletionPredicate = completionPredicate; ResponseHandler = responseHandler; @@ -34,7 +34,6 @@ public Command(HcomMeadowRequestType requestType, } public HcomMeadowRequestType RequestType { get; protected set; } - public ushort DeveloperLevel { get; protected set; } public uint UserData { get; protected set; } public TimeSpan Timeout { get; protected set; } public byte[]? Data { get; protected set; } @@ -80,7 +79,7 @@ protected int ToMessageBytes(ref byte[] messageBytes) // Extra Data Array.Copy( - BitConverter.GetBytes(DeveloperLevel), + BitConverter.GetBytes(HcomProtocolExtraDataDefaultValue), 0, messageBytes, offset, diff --git a/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs b/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs index fe001597..0eb47309 100644 --- a/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs +++ b/Meadow.CLI.Core/Internals/MeadowCommunication/FileCommand.cs @@ -21,7 +21,7 @@ internal FileCommand(HcomMeadowRequestType requestType, Predicate responseHandler, Predicate completionHandler, string commandBuilder) - : base(requestType, timeout, 0, partition, responseHandler, completionHandler, null, true, commandBuilder) + : base(requestType, timeout, partition, null, responseHandler, completionHandler, null, true, commandBuilder) { SourceFileName = sourceFileName; DestinationFileName = destinationFileName; diff --git a/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs b/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs index 41f376f1..b024f6af 100644 --- a/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs +++ b/Meadow.CLI.Core/Internals/MeadowCommunication/SimpleCommandBuilder.cs @@ -17,7 +17,6 @@ public SimpleCommandBuilder(HcomMeadowRequestType requestType) private protected MeadowMessageType? CompletionMessageType; private protected HcomMeadowRequestType RequestType { get; set; } - private protected ushort DeveloperLevel { get; set; } private protected uint UserData { get; set; } private protected TimeSpan Timeout { get; set; } private protected byte[]? Data { get; set; } @@ -32,12 +31,6 @@ public SimpleCommandBuilder WithTimeout(TimeSpan timeout) return this; } - public SimpleCommandBuilder WithDeveloperLevel(ushort level) - { - DeveloperLevel = level; - return this; - } - public SimpleCommandBuilder WithUserData(uint userData) { UserData = userData; @@ -102,14 +95,13 @@ public Command Build() else CompletionPredicate = e => e.MessageType == MeadowMessageType.Concluded; } - return new Command(RequestType, Timeout, DeveloperLevel, UserData, ResponsePredicate, CompletionPredicate, ResponseHandler, IsAcknowledged, ToString()); + return new Command(RequestType, Timeout, UserData, Data, ResponsePredicate, CompletionPredicate, ResponseHandler, IsAcknowledged, ToString()); } public override string ToString() { return $"RequestType: {RequestType} " + $"Timeout: {Timeout} " - + $"DeveloperLevel: {DeveloperLevel} " + $"UserData: {UserData} " + $"ResponseType {ResponseMessageType?.ToString() ?? "none"} " + $"CompletionMessageType: {CompletionMessageType?.ToString() ?? "none"} " diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj index 6b5d3ce6..7f805e96 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.2.2 + 1.0.4.0 diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj index d08d13a4..04f68621 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.2.2 + 1.0.4.0 diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.csproj index 17b21e00..07f99348 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.2.2 + 1.0.4.0 diff --git a/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs b/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs index 75ce5e59..f923fad1 100644 --- a/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs +++ b/Meadow.CLI/Commands/Trace/SetDeveloperValueCommand.cs @@ -19,10 +19,10 @@ public SetDeveloperValueCommand(DownloadManager downloadManager, ILoggerFactory _logger = LoggerFactory.CreateLogger(); } - [CommandOption("developer", 'd', Description = "The developer value to set.")] - public ushort DeveloperLevel { get; set; } + [CommandOption("developer", 'd', Description = "The developer value to set. Valid values are 1 - 4")] + public uint Developer { get; set; } - [CommandOption("value", 'v', Description = "The value to apply to the developer value.")] + [CommandOption("value", 'v', Description = "The value to apply to the developer value. Valid values are 0 to 4,294,967,295")] public uint Value { get; set; } public override async ValueTask ExecuteAsync(IConsole console) @@ -31,14 +31,16 @@ public override async ValueTask ExecuteAsync(IConsole console) var cancellationToken = console.RegisterCancellationHandler(); - try + var task = Developer switch { - await Meadow.SetDeveloper(DeveloperLevel, Value, cancellationToken); - } - catch (Exception ex) - { - _logger.LogError($"Error Setting Developer : {ex.Message}"); - } + 1 => Meadow.SetDeveloper1(Value, cancellationToken), + 2 => Meadow.SetDeveloper2(Value, cancellationToken), + 3 => Meadow.SetDeveloper3(Value, cancellationToken), + 4 => Meadow.SetDeveloper4(Value, cancellationToken), + _ => throw new ArgumentOutOfRangeException(nameof(Developer), Developer, "Valid values are 1 - 4") + }; + + await task; } } } diff --git a/Meadow.CLI/Meadow.CLI.csproj b/Meadow.CLI/Meadow.CLI.csproj index b4355b5c..9bfbc004 100644 --- a/Meadow.CLI/Meadow.CLI.csproj +++ b/Meadow.CLI/Meadow.CLI.csproj @@ -10,7 +10,7 @@ Peter Moody, Adrian Stevens, Brian Kim, Pete Garafano, Dominique Louis Wilderness Labs, Inc true - 1.0.2.2 + 1.0.4.0 AnyCPU http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ icon.png diff --git a/Meadow.Hcom/HcomMeadowRequestType.cs b/Meadow.Hcom/HcomMeadowRequestType.cs index d5146b31..01e52700 100644 --- a/Meadow.Hcom/HcomMeadowRequestType.cs +++ b/Meadow.Hcom/HcomMeadowRequestType.cs @@ -40,10 +40,11 @@ public enum HcomMeadowRequestType : ushort HCOM_MDOW_REQUEST_GET_DEVICE_NAME = 0x1f | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, HCOM_MDOW_REQUEST_GET_INITIAL_FILE_BYTES = 0x20 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, - HCOM_MDOW_REQUEST_GET_FILES_AND_FOLDERS = 0xf3 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, - // Only used for testing - HCOM_MDOW_REQUEST_DEVELOPER = 0xf8 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_1 = 0xf0 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_2 = 0xf1 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_3 = 0xf2 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, + HCOM_MDOW_REQUEST_DEVELOPER_4 = 0xf3 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, HCOM_MDOW_REQUEST_S25FL_QSPI_INIT = 0xf4 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, HCOM_MDOW_REQUEST_S25FL_QSPI_WRITE = 0xf5 | HcomProtocolHeaderTypes.HCOM_PROTOCOL_HEADER_TYPE_SIMPLE, From 01ff67f4dcc7ba4d5dafb59600a5eaa9fd54cd82 Mon Sep 17 00:00:00 2001 From: Dominique Louis Date: Thu, 29 Jun 2023 16:22:07 +0100 Subject: [PATCH 4/8] Build VSCode on main, regardless of dispatch. --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 0d494e22..39a868fb 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -526,7 +526,7 @@ jobs: cd vs-code vsce package --pre-release - - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} + - if: ${{ github.ref == 'refs/heads/main' }} name: Build Release VSIX on main branch run: | cd vs-code From d6bf666ca69b2874367ad54975a4a841c4cf2e0f Mon Sep 17 00:00:00 2001 From: Dominique Louis Date: Thu, 6 Jul 2023 09:13:42 +0100 Subject: [PATCH 5/8] Bump to 1.1 (#319) * Bump to 1.1 * Fix path to Meadow.CLI nuget. --- .github/workflows/dotnet.yml | 12 ++++++------ Meadow.CLI.Core/Constants.cs | 2 +- Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj | 2 +- Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj | 2 +- Meadow.CLI.Core/Meadow.CLI.Core.csproj | 2 +- Meadow.CLI/Meadow.CLI.csproj | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 39a868fb..1e57c5d8 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,8 +1,8 @@ name: Meadow.CLI env: - TOOLS_RELEASE_VERSION: 1.0.4.0 - SHORT_TOOLS_RELEASE_VERSION: 1.0.4 - MEADOW_OS_VERSION: 1.0.2.0 + TOOLS_RELEASE_VERSION: 1.1.0.0 + SHORT_TOOLS_RELEASE_VERSION: 1.1.0 + MEADOW_OS_VERSION: 1.1.0.0 VS_MAC_2019_VERSION: 8.10 VS_MAC_2022_VERSION: 17.5 @@ -72,7 +72,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: Meadow.CLI.nuget.${{ ENV.TOOLS_RELEASE_VERSION }} - path: 'main\**\Meadow.CLI\bin\Release\*.nupkg' + path: 'main\Meadow.CLI\bin\Release\*.nupkg' - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} name: Publish Meadow.CLI Nuget publically @@ -326,7 +326,7 @@ jobs: # - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} #- name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.4 + # uses: actions/upload-release-asset@v1.1.0 # env: # GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }} # with: @@ -434,7 +434,7 @@ jobs: # - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} #- name: Upload Release Asset - # uses: actions/upload-release-asset@v1.0.4 + # uses: actions/upload-release-asset@v1.1.0 # env: # GITHUB_TOKEN: ${{ secrets.MEADOW_MAC_TOKEN }} # with: diff --git a/Meadow.CLI.Core/Constants.cs b/Meadow.CLI.Core/Constants.cs index aad2ff3e..41528b5e 100644 --- a/Meadow.CLI.Core/Constants.cs +++ b/Meadow.CLI.Core/Constants.cs @@ -7,7 +7,7 @@ namespace Meadow.CLI.Core { public static class Constants { - public const string CLI_VERSION = "1.0.4.0"; + public const string CLI_VERSION = "1.1.0.0"; public const ushort HCOM_PROTOCOL_PREVIOUS_VERSION_NUMBER = 0x0006; public const ushort HCOM_PROTOCOL_CURRENT_VERSION_NUMBER = 0x0007; // Used for transmission public const string WILDERNESS_LABS_USB_VID = "2E6A"; diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj index 7f805e96..4c73cbb5 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.4.0 + 1.1.0.0 diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj index 04f68621..a616673f 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.4.0 + 1.1.0.0 diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.csproj index 07f99348..844455f7 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.csproj @@ -11,7 +11,7 @@ preview enable True - 1.0.4.0 + 1.1.0.0 diff --git a/Meadow.CLI/Meadow.CLI.csproj b/Meadow.CLI/Meadow.CLI.csproj index 9bfbc004..b29af853 100644 --- a/Meadow.CLI/Meadow.CLI.csproj +++ b/Meadow.CLI/Meadow.CLI.csproj @@ -10,7 +10,7 @@ Peter Moody, Adrian Stevens, Brian Kim, Pete Garafano, Dominique Louis Wilderness Labs, Inc true - 1.0.4.0 + 1.1.0.0 AnyCPU http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/ icon.png From 158a4cd624e9c990bbab94b2f77ea98a09cdf24e Mon Sep 17 00:00:00 2001 From: Dominique Louis Date: Thu, 6 Jul 2023 17:06:11 +0100 Subject: [PATCH 6/8] Hack to fix list ports on linux (#321) * Fix parsing on Linux. Needs a better solution, but this will do for now. * Fix nuget publishing path, by removing wildcards. --- .github/workflows/dotnet.yml | 2 +- Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 1e57c5d8..cf901f5f 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -77,7 +77,7 @@ jobs: - if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }} name: Publish Meadow.CLI Nuget publically run: | - nuget push main\**\Meadow.CLI\bin\Release\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} + nuget push main\Meadow.CLI\bin\Release\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} build-vswin-2019: runs-on: windows-2019 diff --git a/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs b/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs index 029b6497..8f2c0f71 100644 --- a/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs +++ b/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs @@ -302,8 +302,8 @@ public async static Task> GetMeadowSerialPortsForLinux(ILogger? lo line => { var parts = line.Split(' '); - var source = parts[8]; - var target = parts[10]; + var source = parts[9]; + var target = parts[11]; var port = Path.GetFullPath(Path.Combine(devicePath, target)); return port; }).ToArray(); From 194c6a19781bb8783bef158227988c637e25bfe7 Mon Sep 17 00:00:00 2001 From: Chris Tacke Date: Fri, 7 Jul 2023 15:06:32 -0500 Subject: [PATCH 7/8] Add support for app.build.yaml (#322) * Add support for app.build.yaml --------- Co-authored-by: Dominique Louis --- .../Devices/MeadowLocalDevice.FileManager.cs | 47 +++++++++++++++++-- Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj | 1 + Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj | 1 + Meadow.CLI.Core/Meadow.CLI.Core.csproj | 1 + 4 files changed, 46 insertions(+), 4 deletions(-) diff --git a/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs b/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs index 75e16750..effa7455 100644 --- a/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs +++ b/Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs @@ -10,13 +10,14 @@ using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; +using YamlDotNet.Serialization; namespace Meadow.CLI.Core.Devices { public abstract partial class MeadowLocalDevice { - string[] dllLinkIngoreList = { "System.Threading.Tasks.Extensions.dll" };//, "Microsoft.Extensions.Primitives.dll" }; - string[] pdbLinkIngoreList = { "System.Threading.Tasks.Extensions.pdb" };//, "Microsoft.Extensions.Primitives.pdb" }; + private string[] dllLinkIngoreList = { "System.Threading.Tasks.Extensions.dll" };//, "Microsoft.Extensions.Primitives.dll" }; + private string[] pdbLinkIngoreList = { "System.Threading.Tasks.Extensions.pdb" };//, "Microsoft.Extensions.Primitives.pdb" }; public async Task> GetFilesAndFolders( TimeSpan timeout, @@ -470,7 +471,7 @@ public Task ForwardVisualStudioDataToMono(byte[] debuggerData, //ToDo this is super fragile (extra-super fragile!) //Need updated API to read files after B5.1 - async Task DeleteTemporaryFiles(CancellationToken cancellationToken = default) + private async Task DeleteTemporaryFiles(CancellationToken cancellationToken = default) { var items = await GetFilesAndFolders(new TimeSpan(0, 0, 15), cancellationToken); @@ -523,6 +524,17 @@ async Task DeleteTemporaryFiles(CancellationToken cancellationToken = default) } } + private record BuildOptions + { + public DeployOptions Deploy { get; set; } + + public record DeployOptions + { + public List NoLink { get; set; } + public bool? IncludePDBs { get; set; } + } + } + public async Task DeployApp(string applicationFilePath, string osVersion, bool includePdbs = false, @@ -530,6 +542,33 @@ public async Task DeployApp(string applicationFilePath, IList? noLink = null, CancellationToken cancellationToken = default) { + try + { + // does a meadow.build.yml file exist? + var buildOptionsFile = Path.Combine(Path.GetDirectoryName(applicationFilePath), "app.build.yaml"); + if (File.Exists(buildOptionsFile)) + { + var yaml = File.ReadAllText(buildOptionsFile); + var deserializer = new DeserializerBuilder() + .IgnoreUnmatchedProperties() + .Build(); + var opts = deserializer.Deserialize(yaml); + + if (opts.Deploy.NoLink != null && opts.Deploy.NoLink.Count > 0) + { + noLink = opts.Deploy.NoLink; + } + if (opts.Deploy.IncludePDBs != null) + { + includePdbs = opts.Deploy.IncludePDBs.Value; + } + } + } + catch (Exception ex) + { + Logger.LogInformation($"Failed to read app.build.yaml: {ex.Message}"); + } + try { if (!File.Exists(applicationFilePath)) @@ -661,7 +700,7 @@ async Task AddFile(string file, bool includePdbs) { found = true; } - if(found) { break; } + if (found) { break; } } if (found == false) { diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj index 4c73cbb5..a8d7488f 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.6.0.0.csproj @@ -56,6 +56,7 @@ all + diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj index a616673f..0efdc30f 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.VS2019.csproj @@ -59,6 +59,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + diff --git a/Meadow.CLI.Core/Meadow.CLI.Core.csproj b/Meadow.CLI.Core/Meadow.CLI.Core.csproj index 844455f7..ec39d8ae 100644 --- a/Meadow.CLI.Core/Meadow.CLI.Core.csproj +++ b/Meadow.CLI.Core/Meadow.CLI.Core.csproj @@ -54,6 +54,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + From c53e16d172c5ceb2208a827bd1885797d519b200 Mon Sep 17 00:00:00 2001 From: Dominique Louis Date: Sun, 9 Jul 2023 07:52:11 +0100 Subject: [PATCH 8/8] =?UTF-8?q?Split=20on=20'->=20'=20so=20we=20only=20hav?= =?UTF-8?q?e=20a=20smaller=20array=20and=20only=201=20array=20eleme?= =?UTF-8?q?=E2=80=A6=20(#323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Split on '-> ' so we only have a smaller array and only 1 array element to use. * Use the string[] version of split, for backwards compatibility. --- Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs b/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs index 8f2c0f71..9e4eb1ff 100644 --- a/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs +++ b/Meadow.CLI.Core/DeviceManagement/MeadowDeviceManager.cs @@ -293,17 +293,16 @@ public async static Task> GetMeadowSerialPortsForLinux(ILogger? lo }; using var proc = Process.Start(psi); - proc.WaitForExit(1000); - var output = proc.StandardOutput.ReadToEnd(); + _ = proc?.WaitForExit(1000); + var output = proc?.StandardOutput.ReadToEnd(); return output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) .Where(x => x.Contains("Wilderness_Labs")) .Select( line => { - var parts = line.Split(' '); - var source = parts[9]; - var target = parts[11]; + var parts = line.Split(new[] { "-> " }, StringSplitOptions.RemoveEmptyEntries); + var target = parts[1]; var port = Path.GetFullPath(Path.Combine(devicePath, target)); return port; }).ToArray();