mirror of
https://github.com/mashed-potatoes/PotatoNV.git
synced 2024-11-10 01:02:20 +01:00
parent
1ae13f1a98
commit
cda463c611
17 changed files with 165 additions and 127 deletions
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[submodule "Potato.ImageFlasher"]
|
||||||
|
path = Potato.ImageFlasher
|
||||||
|
url = https://github.com/mashed-potatoes/Potato.ImageFlasher.git
|
||||||
|
[submodule "Potato.Fastboot"]
|
||||||
|
path = Potato.Fastboot
|
||||||
|
url = https://github.com/mashed-potatoes/Potato.Fastboot.git
|
||||||
|
[submodule "HiSiBootloaders"]
|
||||||
|
path = HiSiBootloaders
|
||||||
|
url = https://github.com/mashed-potatoes/HiSiBootloaders.git
|
1
HiSiBootloaders
Submodule
1
HiSiBootloaders
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 013b9ae4039c1e873734377904e7dc2699a2cb48
|
1
Potato.Fastboot
Submodule
1
Potato.Fastboot
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 6267600aa0507c3475f8bd270dacfac93a335b87
|
1
Potato.ImageFlasher
Submodule
1
Potato.ImageFlasher
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 49b4ab4bc93f58da1c93e492032edfc8cfa24c10
|
|
@ -5,6 +5,10 @@ VisualStudioVersion = 16.0.30011.22
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PotatoNV-next", "PotatoNV-next\PotatoNV-next.csproj", "{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PotatoNV-next", "PotatoNV-next\PotatoNV-next.csproj", "{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Potato.Fastboot", "Potato.Fastboot\Potato.Fastboot\Potato.Fastboot.csproj", "{6C04F303-A659-4872-8136-D5C1D48A8F75}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Potato.ImageFlasher", "Potato.ImageFlasher\Potato.ImageFlasher\Potato.ImageFlasher.csproj", "{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -21,6 +25,22 @@ Global
|
||||||
{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}.Release|x64.ActiveCfg = Release|x64
|
{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}.Release|x64.ActiveCfg = Release|x64
|
||||||
{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}.Release|x64.Build.0 = Release|x64
|
{2F103DCF-DFBA-48B0-BEA4-D4B845532A42}.Release|x64.Build.0 = Release|x64
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{6C04F303-A659-4872-8136-D5C1D48A8F75}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{B74D03CC-AC13-447A-BCD8-C2044DA84EEB}.Release|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -14,19 +14,10 @@
|
||||||
<Label Content="Bootloader" />
|
<Label Content="Bootloader" />
|
||||||
<ComboBox Name="deviceBootloader" />
|
<ComboBox Name="deviceBootloader" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel>
|
|
||||||
<Label Content="Serial number (optional)" />
|
|
||||||
<TextBox x:Name="nvSerialNumber" />
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
|
||||||
<Label Content="Board ID (optional)" />
|
|
||||||
<TextBox x:Name="nvBidNumber" />
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Label Content="Unlock code" />
|
<Label Content="Unlock code" />
|
||||||
<TextBox x:Name="nvUnlockCode" />
|
<TextBox x:Name="nvUnlockCode" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<CheckBox x:Name="disableFBLOCK" Content="Disable FBLOCK" IsChecked="True" />
|
<CheckBox x:Name="disableFBLOCK" Content="Disable FBLOCK" IsChecked="True" />
|
||||||
<Button x:Name="startButton" Content="Start!" Height="40" Margin="0,10,0,0" Click="StartButton_Click" />
|
<Button x:Name="startButton" Content="Start!" Height="40" Margin="0,10,0,0" Click="StartButton_Click" />
|
||||||
|
|
|
@ -48,9 +48,7 @@ namespace PotatoNV_next.Controls
|
||||||
{
|
{
|
||||||
public UsbController.Device.DMode TargetMode { get; set; }
|
public UsbController.Device.DMode TargetMode { get; set; }
|
||||||
public string Target { get; set; }
|
public string Target { get; set; }
|
||||||
public string BoardID { get; set; }
|
|
||||||
public string UnlockCode { get; set; }
|
public string UnlockCode { get; set; }
|
||||||
public string SerialNumber { get; set; }
|
|
||||||
public bool DisableFBLOCK { get; set; }
|
public bool DisableFBLOCK { get; set; }
|
||||||
public Bootloader Bootloader { get; set; } = null;
|
public Bootloader Bootloader { get; set; } = null;
|
||||||
}
|
}
|
||||||
|
@ -113,10 +111,6 @@ namespace PotatoNV_next.Controls
|
||||||
|
|
||||||
Assert(deviceBootloader.SelectedIndex != -1, "Couldn't find any valid bootloader!");
|
Assert(deviceBootloader.SelectedIndex != -1, "Couldn't find any valid bootloader!");
|
||||||
|
|
||||||
Assert(VerifyNVValue(nvSerialNumber.Text), "Serial number is not valid.");
|
|
||||||
|
|
||||||
Assert(VerifyNVValue(nvBidNumber.Text), "BoardID is not valid.");
|
|
||||||
|
|
||||||
Assert(VerifyNVValue(nvUnlockCode.Text, true), "Unlock code is not valid.");
|
Assert(VerifyNVValue(nvUnlockCode.Text, true), "Unlock code is not valid.");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -132,9 +126,7 @@ namespace PotatoNV_next.Controls
|
||||||
? UsbController.Device.DMode.Fastboot
|
? UsbController.Device.DMode.Fastboot
|
||||||
: UsbController.Device.DMode.DownloadVCOM,
|
: UsbController.Device.DMode.DownloadVCOM,
|
||||||
Target = deviceList.SelectedItem.ToString(),
|
Target = deviceList.SelectedItem.ToString(),
|
||||||
BoardID = nvBidNumber.Text,
|
|
||||||
UnlockCode = nvUnlockCode.Text,
|
UnlockCode = nvUnlockCode.Text,
|
||||||
SerialNumber = nvSerialNumber.Text,
|
|
||||||
DisableFBLOCK = disableFBLOCK.IsChecked.Value
|
DisableFBLOCK = disableFBLOCK.IsChecked.Value
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,8 +142,6 @@ namespace PotatoNV_next.Controls
|
||||||
{
|
{
|
||||||
deviceList.IsEnabled = IsEnabled;
|
deviceList.IsEnabled = IsEnabled;
|
||||||
deviceBootloader.IsEnabled = IsEnabled;
|
deviceBootloader.IsEnabled = IsEnabled;
|
||||||
nvBidNumber.IsEnabled = IsEnabled;
|
|
||||||
nvSerialNumber.IsEnabled = IsEnabled;
|
|
||||||
nvUnlockCode.IsEnabled = IsEnabled;
|
nvUnlockCode.IsEnabled = IsEnabled;
|
||||||
disableFBLOCK.IsEnabled = IsEnabled;
|
disableFBLOCK.IsEnabled = IsEnabled;
|
||||||
startButton.IsEnabled = IsEnabled;
|
startButton.IsEnabled = IsEnabled;
|
||||||
|
|
|
@ -18,6 +18,11 @@ namespace PotatoNV_next
|
||||||
private Fastboot fb;
|
private Fastboot fb;
|
||||||
private Controls.NVForm.FormEventArgs args;
|
private Controls.NVForm.FormEventArgs args;
|
||||||
|
|
||||||
|
private void LogResponse(Fastboot.Response response)
|
||||||
|
{
|
||||||
|
Log.Debug($"response: {Encoding.UTF8.GetString(response.RawData)}");
|
||||||
|
}
|
||||||
|
|
||||||
private void FlashBootloader(Bootloader bootloader, string port)
|
private void FlashBootloader(Bootloader bootloader, string port)
|
||||||
{
|
{
|
||||||
var flasher = new ImageFlasher();
|
var flasher = new ImageFlasher();
|
||||||
|
@ -28,22 +33,19 @@ namespace PotatoNV_next
|
||||||
|
|
||||||
foreach (var image in bootloader.Images)
|
foreach (var image in bootloader.Images)
|
||||||
{
|
{
|
||||||
Log.Debug($"VrStat of {image.Role}: {image.IsValid}");
|
|
||||||
|
|
||||||
if (!image.IsValid)
|
if (!image.IsValid)
|
||||||
{
|
{
|
||||||
throw new Exception($"Image `{image.Role}` is invalid!");
|
throw new Exception($"Image `{image.Role}` is not valid!");
|
||||||
}
|
}
|
||||||
|
|
||||||
asize += image.Size;
|
asize += image.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Success("Verification passed!");
|
|
||||||
Log.Debug($"Opening {port}...");
|
Log.Debug($"Opening {port}...");
|
||||||
|
|
||||||
flasher.Open(port);
|
flasher.Open(port);
|
||||||
|
|
||||||
Log.Info($"Uploading {bootloader.Name} bootloader");
|
Log.Info($"Uploading {bootloader.Name}...");
|
||||||
|
|
||||||
foreach (var image in bootloader.Images)
|
foreach (var image in bootloader.Images)
|
||||||
{
|
{
|
||||||
|
@ -60,39 +62,43 @@ namespace PotatoNV_next
|
||||||
|
|
||||||
flasher.Close();
|
flasher.Close();
|
||||||
|
|
||||||
Log.Success("Bootloader uploaded");
|
|
||||||
Log.SetProgressBar(false);
|
Log.SetProgressBar(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ReadInfo()
|
private void ReadInfo()
|
||||||
{
|
{
|
||||||
var serial = fb.GetSerialNumber();
|
var serial = fb.GetSerialNumber();
|
||||||
Log.Info($"- Serial number: {serial}");
|
Log.Info($"Serial number: {serial}");
|
||||||
|
|
||||||
var bsn = fb.Command("oem read_bsn");
|
var bsn = fb.Command("oem read_bsn");
|
||||||
Log.Info($"- Board ID: {bsn.Payload}");
|
if (bsn.Status == Fastboot.Status.Okay)
|
||||||
|
{
|
||||||
|
Log.Info($"Board ID: {bsn.Payload}");
|
||||||
|
}
|
||||||
|
|
||||||
var model = fb.Command("oem get-product-model");
|
var model = fb.Command("oem get-product-model");
|
||||||
Log.Info($"- Model: {model.Payload}");
|
Log.Info($"Model: {model.Payload}");
|
||||||
|
|
||||||
var build = fb.Command("oem get-build-number");
|
var build = fb.Command("oem get-build-number");
|
||||||
Log.Info($"- Build number: {build.Payload.Replace(":", "")}");
|
Log.Info($"Build number: {build.Payload.Replace(":", "")}");
|
||||||
|
|
||||||
var regex = new Regex(@"FB[\w: ]{1,}UNLOCKED");
|
var regex = new Regex(@"FB[\w: ]{1,}UNLOCKED");
|
||||||
var fblock = fb.Command("oem lock-state info");
|
var fblock = fb.Command("oem lock-state info");
|
||||||
var state = regex.IsMatch(fblock.Payload);
|
var state = regex.IsMatch(fblock.Payload);
|
||||||
|
|
||||||
Log.Info($"- FBLOCK state: {(state ? "unlocked" : "locked")}");
|
Log.Info($"FBLOCK state: {(state ? "unlocked" : "locked")}");
|
||||||
|
LogResponse(fblock);
|
||||||
|
|
||||||
if (!state)
|
if (!state)
|
||||||
{
|
{
|
||||||
throw new Exception("FBLOCK is locked!");
|
Log.Error("FBLOCK is locked!");
|
||||||
|
// throw new Exception("FBLOCK is locked!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetNVMEProp(string prop, byte[] value, string role = null)
|
private void SetNVMEProp(string prop, byte[] value)
|
||||||
{
|
{
|
||||||
Log.Info($"- Writing {role ?? prop}");
|
Log.Info($"Writing {prop}...");
|
||||||
|
|
||||||
var cmd = new List<byte>();
|
var cmd = new List<byte>();
|
||||||
|
|
||||||
|
@ -101,17 +107,14 @@ namespace PotatoNV_next
|
||||||
|
|
||||||
var res = fb.Command(cmd.ToArray());
|
var res = fb.Command(cmd.ToArray());
|
||||||
|
|
||||||
|
LogResponse(res);
|
||||||
|
|
||||||
if (!res.Payload.Contains("set nv ok"))
|
if (!res.Payload.Contains("set nv ok"))
|
||||||
{
|
{
|
||||||
throw new Exception($"Failed to set prop: {res.Payload}");
|
throw new Exception($"Failed to set: {res.Payload}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetNVMEProp(string prop, string value, string role = null)
|
|
||||||
{
|
|
||||||
SetNVMEProp(prop, Encoding.ASCII.GetBytes(value), role);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] GetSHA256(string str)
|
public static byte[] GetSHA256(string str)
|
||||||
{
|
{
|
||||||
using (var sha256 = SHA256.Create())
|
using (var sha256 = SHA256.Create())
|
||||||
|
@ -120,20 +123,66 @@ namespace PotatoNV_next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteNVME()
|
private void SetHWDogCertify(byte state)
|
||||||
{
|
{
|
||||||
SetNVMEProp("FBLOCK", new[] { (byte)(args.DisableFBLOCK ? 0 : 1) }, "FBLOCK state");
|
foreach (var command in new[] { "hwdog certify set", "backdoor set" })
|
||||||
|
|
||||||
SetNVMEProp("USRKEY", GetSHA256(args.UnlockCode), "User key");
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(args.SerialNumber))
|
|
||||||
{
|
{
|
||||||
SetNVMEProp("SN", args.SerialNumber, "Serial number");
|
Log.Info($"Trying {command}...");
|
||||||
|
var res = fb.Command($"oem {command} {state}");
|
||||||
|
LogResponse(res);
|
||||||
|
if (res.Status == Fastboot.Status.Okay || res.Payload.Contains("equal"))
|
||||||
|
{
|
||||||
|
Log.Success($"{command}: success");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Log.Error("Failed to set FBLOCK state!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(args.BoardID))
|
private void WidevineLock()
|
||||||
{
|
{
|
||||||
SetNVMEProp("BOARDID", args.BoardID, "Board ID");
|
Log.Debug("WV Lock");
|
||||||
|
var res = fb.Command("getvar:nve:WVLOCK");
|
||||||
|
LogResponse(res);
|
||||||
|
if (res.Status != Fastboot.Status.Fail && res.Payload.Replace("\n", "").Trim() != "UUUUUUUUUUUUUUUU")
|
||||||
|
{
|
||||||
|
Log.Info($"Read factory key: {res.Payload}");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetNVMEProp("WVLOCK", Encoding.ASCII.GetBytes(args.UnlockCode));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Log.Error("Failed to set the WVLOCK.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteNVME()
|
||||||
|
{
|
||||||
|
var fblockState = (byte)(args.DisableFBLOCK ? 0 : 1);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetNVMEProp("FBLOCK", new[] { fblockState });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error("Failed to set the FBLOCK, using the alternative method...");
|
||||||
|
Log.Debug(ex.Message);
|
||||||
|
SetHWDogCertify(fblockState);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SetNVMEProp("USRKEY", GetSHA256(args.UnlockCode));
|
||||||
|
WidevineLock();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error("Failed to set the key.");
|
||||||
|
Log.Debug(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,28 +195,23 @@ namespace PotatoNV_next
|
||||||
{
|
{
|
||||||
if (args.TargetMode == UsbController.Device.DMode.DownloadVCOM)
|
if (args.TargetMode == UsbController.Device.DMode.DownloadVCOM)
|
||||||
{
|
{
|
||||||
Log.Info("--> Flashing bootloader");
|
|
||||||
FlashBootloader(args.Bootloader, args.Target.Split(':')[0]);
|
FlashBootloader(args.Bootloader, args.Target.Split(':')[0]);
|
||||||
|
|
||||||
Log.Info("Waiting for any device...");
|
Log.Info("Waiting for any device...");
|
||||||
fb.Wait();
|
fb.Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Info("--> Reading information");
|
Log.Info("Connecting...");
|
||||||
Log.Info("Connecting to fastboot device...");
|
|
||||||
|
|
||||||
fb.Connect();
|
fb.Connect();
|
||||||
ReadInfo();
|
ReadInfo();
|
||||||
|
|
||||||
Log.Info("--> Updating NVME");
|
|
||||||
WriteNVME();
|
WriteNVME();
|
||||||
|
|
||||||
Log.Success("Update done!");
|
|
||||||
Log.Info("Rebooting...");
|
Log.Info("Rebooting...");
|
||||||
|
|
||||||
fb.Command("reboot");
|
fb.Command("reboot");
|
||||||
|
|
||||||
Log.Info($"Bootloader unlock code: {args.UnlockCode}");
|
Log.Info($"New bootloader unlock code: {args.UnlockCode}");
|
||||||
|
|
||||||
fb.Disconnect();
|
fb.Disconnect();
|
||||||
}
|
}
|
||||||
|
@ -176,6 +220,10 @@ namespace PotatoNV_next
|
||||||
Log.Error(ex.Message);
|
Log.Error(ex.Message);
|
||||||
Log.Debug(ex.StackTrace);
|
Log.Debug(ex.StackTrace);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
fb.Disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartProcess(Controls.NVForm.FormEventArgs args)
|
public void StartProcess(Controls.NVForm.FormEventArgs args)
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="TextBox">
|
<Style TargetType="TextBox">
|
||||||
<Setter Property="FontFamily" Value="Consolas" />
|
|
||||||
<Setter Property="MaxLength" Value="16" />
|
<Setter Property="MaxLength" Value="16" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ namespace PotatoNV_next
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
IntegrityCheck.Run();
|
|
||||||
|
|
||||||
Icon = MediaConverter.ImageSourceFromBitmap(Properties.Resources.Fire.ToBitmap());
|
Icon = MediaConverter.ImageSourceFromBitmap(Properties.Resources.Fire.ToBitmap());
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,6 @@
|
||||||
<Reference Include="LibUsbDotNet.LibUsbDotNet, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c677239abe1e02a9, processorArchitecture=MSIL">
|
<Reference Include="LibUsbDotNet.LibUsbDotNet, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c677239abe1e02a9, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\LibUsbDotNet.2.2.29\lib\net45\LibUsbDotNet.LibUsbDotNet.dll</HintPath>
|
<HintPath>..\packages\LibUsbDotNet.2.2.29\lib\net45\LibUsbDotNet.LibUsbDotNet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Potato.Fastboot, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Potato.Fastboot.1.1.0\lib\net472\Potato.Fastboot.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Potato.ImageFlasher, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Potato.ImageFlasher.1.0.1\lib\net472\Potato.ImageFlasher.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
@ -122,7 +116,6 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Core.cs" />
|
<Compile Include="Core.cs" />
|
||||||
<Compile Include="Utils\Bootloader.cs" />
|
<Compile Include="Utils\Bootloader.cs" />
|
||||||
<Compile Include="Utils\IntegrityCheck.cs" />
|
|
||||||
<Compile Include="Utils\Log.cs" />
|
<Compile Include="Utils\Log.cs" />
|
||||||
<Compile Include="Utils\MediaConverter.cs" />
|
<Compile Include="Utils\MediaConverter.cs" />
|
||||||
<Compile Include="Utils\UsbController.cs" />
|
<Compile Include="Utils\UsbController.cs" />
|
||||||
|
@ -194,6 +187,21 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\fire.ico" />
|
<None Include="Resources\fire.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Potato.Fastboot\Potato.Fastboot\Potato.Fastboot.csproj">
|
||||||
|
<Project>{6c04f303-a659-4872-8136-d5c1d48a8f75}</Project>
|
||||||
|
<Name>Potato.Fastboot</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Potato.ImageFlasher\Potato.ImageFlasher\Potato.ImageFlasher.csproj">
|
||||||
|
<Project>{b74d03cc-ac13-447a-bcd8-c2044da84eeb}</Project>
|
||||||
|
<Name>Potato.ImageFlasher</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PostBuildEvent>PowerShell -noprofile -executionpolicy bypass -file "$(ProjectDir)post-build.ps1" $(TargetDir) $(SolutionDir)</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>git submodule update --remote</PreBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -20,5 +20,5 @@ using System.Windows;
|
||||||
ResourceDictionaryLocation.SourceAssembly
|
ResourceDictionaryLocation.SourceAssembly
|
||||||
)]
|
)]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.0.1.0")]
|
[assembly: AssemblyVersion("2.1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("2.0.1.0")]
|
[assembly: AssemblyFileVersion("2.1.0.0")]
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace PotatoNV_next.Utils
|
|
||||||
{
|
|
||||||
class IntegrityCheck
|
|
||||||
{
|
|
||||||
protected static string[] Checks = new string[] {
|
|
||||||
"libusb-1.0.dll",
|
|
||||||
"LibUsbDotNet.LibUsbDotNet.dll",
|
|
||||||
"Potato.Fastboot.dll",
|
|
||||||
"Potato.ImageFlasher.dll",
|
|
||||||
"bootloaders/"
|
|
||||||
};
|
|
||||||
|
|
||||||
public static void Run()
|
|
||||||
{
|
|
||||||
var issues = new List<string>();
|
|
||||||
|
|
||||||
foreach (var f in Checks)
|
|
||||||
{
|
|
||||||
var isDir = f.EndsWith("/");
|
|
||||||
var path = Path.Combine(Environment.CurrentDirectory, f);
|
|
||||||
|
|
||||||
if (isDir ? !Directory.Exists(path) : !File.Exists(path))
|
|
||||||
{
|
|
||||||
issues.Add($"{f}: not found");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (issues.Count > 0)
|
|
||||||
{
|
|
||||||
MessageBox.Show(string.Join("\n", issues), "Integrity check failed", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
Environment.Exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="LibUsbDotNet" version="2.2.29" targetFramework="net472" />
|
<package id="LibUsbDotNet" version="2.2.29" targetFramework="net472" />
|
||||||
<package id="Potato.Fastboot" version="1.1.0" targetFramework="net472" />
|
|
||||||
<package id="Potato.ImageFlasher" version="1.0.1" targetFramework="net472" />
|
|
||||||
</packages>
|
</packages>
|
3
PotatoNV-next/post-build.ps1
Normal file
3
PotatoNV-next/post-build.ps1
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
$out = "$($args[0])\bootloaders"
|
||||||
|
New-Item -ItemType Directory -Force -Path $out
|
||||||
|
Get-ChildItem -Directory -Path "$($args[1])\HiSiBootloaders" | Copy-Item -Destination $out -Recurse -Container -Verbose
|
29
README.md
29
README.md
|
@ -1,4 +1,5 @@
|
||||||
# PotatoNV
|
# PotatoNV
|
||||||
|
|
||||||
[![Build status](https://ci.appveyor.com/api/projects/status/0ra9b57aakdo5ms6?svg=true)](https://ci.appveyor.com/project/mashed-potatoes/potatonv)
|
[![Build status](https://ci.appveyor.com/api/projects/status/0ra9b57aakdo5ms6?svg=true)](https://ci.appveyor.com/project/mashed-potatoes/potatonv)
|
||||||
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/mashed-potatoes/PotatoNV?include_prereleases)
|
![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/mashed-potatoes/PotatoNV?include_prereleases)
|
||||||
![GitHub](https://img.shields.io/github/license/mashed-potatoes/PotatoNV)
|
![GitHub](https://img.shields.io/github/license/mashed-potatoes/PotatoNV)
|
||||||
|
@ -19,28 +20,30 @@ Click below to download the latest version:
|
||||||
<img src="https://raw.githubusercontent.com/mashed-potatoes/PotatoNV/master/assets/cool-button.png" width="520" height="auto">
|
<img src="https://raw.githubusercontent.com/mashed-potatoes/PotatoNV/master/assets/cool-button.png" width="520" height="auto">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
## List of tested devices
|
## Tested devices
|
||||||
|
|
||||||
Device | Model | Bootloader
|
Device | Model | Bootloader
|
||||||
------ | --- | ----- |
|
------ | --- | ----- |
|
||||||
Honor 7X | `BND` | Kirin 659 (A)
|
Honor 5C / 7 Lite | `NEM` | Kirin 65x (A)
|
||||||
Honor 8 Pro / V9 | `DUK` | Kirin 960
|
Honor 7X | `BND` | Kirin 65x (A)
|
||||||
Honor 9 Lite | `LLD` | Kirin 659 (A)
|
Honor 8 | `FRD` | Kirin 950
|
||||||
|
Honor 8 Pro / V9 | `DUK` | Kirin 950
|
||||||
|
Honor 9 Lite | `LLD` | Kirin 65x (A)
|
||||||
Honor 9 | `STF` | Kirin 960
|
Honor 9 | `STF` | Kirin 960
|
||||||
Huawei Mate 9 | `MHA` | Kirin 960
|
Huawei Mate 9 | `MHA` | Kirin 960
|
||||||
Huawei Mate 9 Pro | `LON` | Kirin 960
|
Huawei Mate 9 Pro | `LON` | Kirin 960
|
||||||
Huawei MediaPad M5 Lite | `BAH2` | Kirin 659 (B)
|
Huawei MediaPad M5 Lite | `BAH2` | Kirin 65x (B)
|
||||||
Huawei MediaPad M5 | `CMR` | Kirin 960
|
Huawei MediaPad M5 | `CMR` | Kirin 960
|
||||||
Huawei MediaPad T5 | `AGS2` | Kirin 659 (A)
|
Huawei MediaPad T5 | `AGS2` | Kirin 65x (A)
|
||||||
Huawei Nova 2 | `PIC` | Kirin 659 (A)
|
Huawei Nova 2 | `PIC` | Kirin 65x (A)
|
||||||
Huawei Nova 2i / Mate 10 Lite | `RNE` | Kirin 659 (B)
|
Huawei Nova 2i / Mate 10 Lite | `RNE` | Kirin 65x (B)
|
||||||
Huawei Nova 2s | `HWI` | Kirin 960
|
Huawei Nova 2s | `HWI` | Kirin 960
|
||||||
Huawei P Smart 2018 | `FIG` | Kirin 659 (B)
|
Huawei P Smart 2018 | `FIG` | Kirin 65x (B)
|
||||||
Huawei P10 | `VTR` | Kirin 960
|
Huawei P10 | `VTR` | Kirin 960
|
||||||
Huawei P20 Lite / Nova 3e | `ANE` | Kirin 659 (A)
|
Huawei P20 Lite / Nova 3e | `ANE` | Kirin 65x (A)
|
||||||
Huawei P8 Lite (2017) | `PRA` | Kirin 659 (A)
|
Huawei P8 Lite (2017) | `PRA` | Kirin 65x (A)
|
||||||
Huawei P9 Lite | `VNS` | Kirin 659 (A)
|
Huawei P9 Lite | `VNS` | Kirin 65x (A)
|
||||||
Huawei Y9 (2018) | `FLA` | Kirin 659 (A)
|
Huawei Y9 (2018) | `FLA` | Kirin 65x (A)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
13
appveyor.yml
13
appveyor.yml
|
@ -1,8 +1,17 @@
|
||||||
version: 2.0.0-{build}
|
version: 2.1.0-{build}
|
||||||
configuration: Debug
|
configuration: Debug
|
||||||
clone_depth: 1
|
clone_script:
|
||||||
|
- cmd: >-
|
||||||
|
git clone -q --branch=%APPVEYOR_REPO_BRANCH% https://github.com/%APPVEYOR_REPO_NAME%.git %APPVEYOR_BUILD_FOLDER%
|
||||||
|
&& cd %APPVEYOR_BUILD_FOLDER%
|
||||||
|
&& git checkout -qf %APPVEYOR_REPO_COMMIT%
|
||||||
|
&& git submodule update --init --recursive
|
||||||
before_build:
|
before_build:
|
||||||
- cmd: nuget restore
|
- cmd: nuget restore
|
||||||
build:
|
build:
|
||||||
project: PotatoNV-next.sln
|
project: PotatoNV-next.sln
|
||||||
verbosity: normal
|
verbosity: normal
|
||||||
|
artifacts:
|
||||||
|
- path: PotatoNV-next\bin\$(configuration)
|
||||||
|
name: PotatoNV-appveyor
|
||||||
|
type: zip
|
||||||
|
|
Loading…
Reference in a new issue