diff --git a/Libraries/FelLib b/Libraries/FelLib index e28ddfed0..1e304ba6a 160000 --- a/Libraries/FelLib +++ b/Libraries/FelLib @@ -1 +1 @@ -Subproject commit e28ddfed0e2dea29279fb37fa379329329fa6cca +Subproject commit 1e304ba6a95fe8cff3818ea935c7ae1691b83f29 diff --git a/WaitingFelForm.cs b/WaitingFelForm.cs index 22f579d19..2a78ddbdc 100644 --- a/WaitingFelForm.cs +++ b/WaitingFelForm.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; using System.IO; +using System.Threading; using System.Windows.Forms; namespace com.clusterrr.hakchi_gui @@ -79,6 +80,40 @@ private void timer_Tick(object sender, EventArgs e) { if (Fel.DeviceExists()) { + using (Fel fel = new Fel()) + { + try + { + fel.WriteLine += (string message) => Trace.WriteLine(message); + if (!fel.Open(isFel: false)) + { + throw new Exception("USB Device Not Found"); + } + + if (!fel.UsbUpdateProbe()) + throw new Exception("Failed to handshake with burn mode"); + if (!fel.UsbUpdateEnterFel()) + throw new Exception("Failed to enter FEL"); + + timer.Enabled = false; + + new Thread(() => + { + Invoke(new Action(() => + { + Thread.Sleep(1000); + + DialogResult = DialogResult.OK; + deviceFound = true; + Close(); + })); + }).Start(); + + return; + } + catch (Exception) { } + + } DialogResult = DialogResult.OK; timer.Enabled = false; deviceFound = true;