Skip to content

Commit

Permalink
[windows] sonixflasher 2.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dexter93 committed Sep 18, 2024
1 parent b88f114 commit aaf34d6
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions windows/QMK Toolbox/Helpers/EmbeddedResourceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static class EmbeddedResourceHelper
"mdloader.exe",
"teensy_loader_cli.exe",
"wb32-dfu-updater_cli.exe",
"sonixflasher.exe",
"libftdi1.dll",
"libhidapi-0.dll",
"libusb-0-1-4.dll",
Expand Down
1 change: 1 addition & 0 deletions windows/QMK Toolbox/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private void MainWindow_Load(object sender, EventArgs e)
logTextBox.LogInfo(" - HalfKay (Teensy, Ergodox EZ) via Teensy Loader (https://pjrc.com/teensy/loader_cli.html)");
logTextBox.LogInfo(" - LUFA/QMK HID via hid_bootloader_cli (https://github.com/abcminiuser/lufa)");
logTextBox.LogInfo(" - WB32 DFU via wb32-dfu-updater_cli (https://github.com/WestberryTech/wb32-dfu-updater)");
logTextBox.LogInfo(" - SN32 DFU via sonixflasher (https://github.com/SonixQMK/SonixFlasherC)");
logTextBox.LogInfo(" - LUFA Mass Storage");
logTextBox.LogInfo("Supported ISP flashers:");
logTextBox.LogInfo(" - AVRISP (Arduino ISP)");
Expand Down
1 change: 1 addition & 0 deletions windows/QMK Toolbox/QMK Toolbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<EmbeddedResource Include="Resources\qmk_driver_installer.exe" />
<EmbeddedResource Include="Resources\teensy_loader_cli.exe" />
<EmbeddedResource Include="Resources\wb32-dfu-updater_cli.exe" />
<EmbeddedResource Include="Resources\sonixflasher.exe" />
<EmbeddedResource Include="Resources\libftdi1.dll" />
<EmbeddedResource Include="Resources\libhidapi-0.dll" />
<EmbeddedResource Include="Resources\libusb-0-1-4.dll" />
Expand Down
Binary file added windows/QMK Toolbox/Resources/sonixflasher.exe
Binary file not shown.
1 change: 1 addition & 0 deletions windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum BootloaderType
UsbAsp,
UsbTinyIsp,
Wb32Dfu,
Sn32Dfu,
None
}
}
34 changes: 34 additions & 0 deletions windows/QMK Toolbox/Usb/Bootloader/Sn32DfuDevice.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.IO;
using System.Threading.Tasks;

namespace QMK_Toolbox.Usb.Bootloader
{
class Sn32DfuDevice : BootloaderDevice
{
public Sn32DfuDevice(UsbDevice d) : base(d)
{
Type = BootloaderType.Sn32Dfu;
Name = "SN32 DFU";
PreferredDriver = "HidUsb";

}

public async override Task Flash(string mcu, string file)
{
if (Path.GetExtension(file)?.ToLower() == ".bin")
{
if (ProductId == 0x7010) // SN32F260
{
await RunProcessAsync("sonixflasher.exe", $"-v {VendorId:x4}:{ProductId:x4} -o 0x200 -f \"{file}\"");
return;
}

await RunProcessAsync("sonixflasher.exe", $"-v {VendorId:x4}:{ProductId:x4} -f \"{file}\"");
}
else
{
PrintMessage("Only firmware files in .bin format can be flashed with sonixflasher!", MessageType.Error);
}
}
}
}
13 changes: 13 additions & 0 deletions windows/QMK Toolbox/Usb/UsbListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ private static IUsbDevice CreateDevice(ManagementBaseObject d)
return new UsbTinyIspDevice(usbDevice);
case BootloaderType.Wb32Dfu:
return new Wb32DfuDevice(usbDevice);
case BootloaderType.Sn32Dfu:
return new Sn32DfuDevice(usbDevice);
default:
break;
}
Expand Down Expand Up @@ -315,6 +317,17 @@ private static BootloaderType GetDeviceType(ushort vendorId, ushort productId, u
return BootloaderType.Wb32Dfu;
}
break;
case 0x0c45: // Sonix
switch (productId)
{
case 0x7010: // SN32F260
return BootloaderType.Sn32Dfu;
case 0x7040: // SN32F240b
return BootloaderType.Sn32Dfu;
case 0x7900: // SN32F240
return BootloaderType.Sn32Dfu;
}
break;
}

return BootloaderType.None;
Expand Down

0 comments on commit aaf34d6

Please sign in to comment.