Skip to content

Commit

Permalink
Update FelLib
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 committed Jun 15, 2020
1 parent fce0b31 commit 8cff795
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions WaitingFelForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Windows.Forms;

namespace com.clusterrr.hakchi_gui
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8cff795

Please sign in to comment.