From 64681456a3e2cd3e10a0268fcd9fb693ca741c5f Mon Sep 17 00:00:00 2001 From: sheltonyu Date: Tue, 13 Aug 2024 11:14:11 +0800 Subject: [PATCH 1/2] [windows] add support ArteryTek device --- .../PublishProfiles/FolderProfile.pubxml | 19 ++++++++++++ windows/QMK Toolbox/QMK Toolbox.csproj | 14 +++++++-- windows/QMK Toolbox/Resources/drivers.txt | 1 + .../Usb/Bootloader/AT32DfuDevice.cs | 30 +++++++++++++++++++ .../Usb/Bootloader/BootloaderType.cs | 1 + windows/QMK Toolbox/Usb/UsbListener.cs | 8 +++++ 6 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 windows/QMK Toolbox/Usb/Bootloader/AT32DfuDevice.cs diff --git a/windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml b/windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000000..08de6b1fc4 --- /dev/null +++ b/windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,19 @@ + + + + + Release + x86 + bin\Release\publish\win-x86\ + FileSystem + <_TargetId>Folder + net6.0-windows10.0.18362.0 + win-x86 + true + true + false + false + + \ No newline at end of file diff --git a/windows/QMK Toolbox/QMK Toolbox.csproj b/windows/QMK Toolbox/QMK Toolbox.csproj index 879c18f938..2a1ac6e054 100644 --- a/windows/QMK Toolbox/QMK Toolbox.csproj +++ b/windows/QMK Toolbox/QMK Toolbox.csproj @@ -1,14 +1,15 @@  - net6.0-windows10.0.19041.0 + net6.0-windows10.0.18362.0 WinExe qmk_toolbox true true true false - true + FALSE false + AnyCPU;x86 Resources\output.ico @@ -26,6 +27,8 @@ A flashing/debug utility for devices running QMK Firmware 0.3.3 QMK Toolbox + True + False @@ -90,6 +93,10 @@ 5.7.0 all + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + 3.3.40 @@ -111,4 +118,7 @@ Settings.Designer.cs + + + \ No newline at end of file diff --git a/windows/QMK Toolbox/Resources/drivers.txt b/windows/QMK Toolbox/Resources/drivers.txt index 0490bfa4ab..c3734cd219 100644 --- a/windows/QMK Toolbox/Resources/drivers.txt +++ b/windows/QMK Toolbox/Resources/drivers.txt @@ -7,6 +7,7 @@ winusb,STM32 Bootloader,0483,DF11,6d98a87f-4ecf-464d-89ed-8c684d857a75 winusb,APM32 Bootloader,314B,0106,9ff3cc31-6772-4a3f-a492-a80d91f7a853 winusb,WB32 Bootloader,342D,DFA0,89b0fdf0-3d22-4408-8393-32147ba508ce winusb,GD32V Bootloader,28E9,0189,e1421fd6-f799-4b6c-97e6-39e87d37f858 +winusb,AT32 Bootloader,2E3C,DF11,d70683b3-0498-4979-9a17-e1c62fa6b85d winusb,STM32duino Bootloader,1EAF,0003,746915ec-99d8-4a90-a722-3c85ba31e4fe libusbk,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724 winusb,Kiibohd DFU Bootloader,1C11,B007,aa5a3f86-b81e-4416-89ad-0c1ea1ed63af diff --git a/windows/QMK Toolbox/Usb/Bootloader/AT32DfuDevice.cs b/windows/QMK Toolbox/Usb/Bootloader/AT32DfuDevice.cs new file mode 100644 index 0000000000..3dadd8e84c --- /dev/null +++ b/windows/QMK Toolbox/Usb/Bootloader/AT32DfuDevice.cs @@ -0,0 +1,30 @@ +using System.IO; +using System.Threading.Tasks; + +namespace QMK_Toolbox.Usb.Bootloader +{ + class AT32DfuDevice : BootloaderDevice + { + public AT32DfuDevice(UsbDevice d) : base(d) + { + Type = BootloaderType.AT32Dfu; + Name = "AT32 DFU"; + PreferredDriver = "WinUSB"; + IsResettable = true; + } + + public async override Task Flash(string mcu, string file) + { + if (Path.GetExtension(file)?.ToLower() == ".bin") + { + await RunProcessAsync("dfu-util.exe", $"-a 0 -d 2E3C:DF11 -s 0x08000000:leave -D \"{file}\""); + } + else + { + PrintMessage("Only firmware files in .bin format can be flashed with dfu-util!", MessageType.Error); + } + } + + public async override Task Reset(string mcu) => await RunProcessAsync("dfu-util.exe", "-a 0 -d 2E3C:DF11 -s 0x08000000:leave"); + } +} diff --git a/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs b/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs index 13ade35513..3af4e303e3 100644 --- a/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs +++ b/windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs @@ -20,6 +20,7 @@ public enum BootloaderType UsbAsp, UsbTinyIsp, Wb32Dfu, + AT32Dfu, None } } diff --git a/windows/QMK Toolbox/Usb/UsbListener.cs b/windows/QMK Toolbox/Usb/UsbListener.cs index 58ddc0b62d..b918b9960f 100644 --- a/windows/QMK Toolbox/Usb/UsbListener.cs +++ b/windows/QMK Toolbox/Usb/UsbListener.cs @@ -180,6 +180,8 @@ private static IUsbDevice CreateDevice(ManagementBaseObject d) return new UsbTinyIspDevice(usbDevice); case BootloaderType.Wb32Dfu: return new Wb32DfuDevice(usbDevice); + case BootloaderType.AT32Dfu: + return new AT32DfuDevice(usbDevice); default: break; } @@ -315,6 +317,12 @@ private static BootloaderType GetDeviceType(ushort vendorId, ushort productId, u return BootloaderType.Wb32Dfu; } break; + case 0x2E3C: // ArteryTech + if (productId == 0xDF11) + { + return BootloaderType.AT32Dfu; + } + break; } return BootloaderType.None; From 6644db13e8ef1fc82239504ac4fb309e803efb3b Mon Sep 17 00:00:00 2001 From: sheltonyu Date: Tue, 13 Aug 2024 11:19:31 +0800 Subject: [PATCH 2/2] delete unused folder --- .../PublishProfiles/FolderProfile.pubxml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml diff --git a/windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml b/windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml deleted file mode 100644 index 08de6b1fc4..0000000000 --- a/windows/QMK Toolbox/Properties/PublishProfiles/FolderProfile.pubxml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Release - x86 - bin\Release\publish\win-x86\ - FileSystem - <_TargetId>Folder - net6.0-windows10.0.18362.0 - win-x86 - true - true - false - false - - \ No newline at end of file