Skip to content
Permalink
Browse files

Avrdude 6.3 compatibility

Avrdude 6.3 had added a device signature guess feature which broke
AVRDUDESS's signature parsing code for auto detection
  • Loading branch information
zkemble committed Oct 6, 2016
1 parent 2081841 commit 87016cbd232b6eee375261fa81caa302123ec7b6
Showing with 266 additions and 63 deletions.
  1. +19 −27 src/avrdudess/Avrdude.cs
  2. +247 −36 src/avrdudess/avrdude.conf
  3. BIN src/avrdudess/avrdude.exe
@@ -383,39 +383,31 @@ private void detectComplete(object param)
int pos = log.IndexOf("device signature");
if (pos > -1)
{
// Cut out line
// Remove upto "device signature" line
log = log.Substring(pos);
log = log.Substring(0, log.IndexOf(Environment.NewLine));

// Split by =
string[] signature = log.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);

// Check split result
if (signature.Length == 2 && signature[0].Trim() == "device signature")
int sigStart = log.IndexOf("0x"); // Look for signature hex value
if (sigStart > -1)
{
// Remove 0x and spaces from signature
string detectedSignature = signature[1].Trim(new char[] { ' ', '"', ';' }).Replace("0x", "").Replace(" ", "");
// Get the 6 hex digits
string detectedSignature = log.Substring(sigStart + 2, 6);

// Found something
if (detectedSignature != "")
{
// Look for MCU with same signature
MCU m = mcus.Find(s => s.signature == detectedSignature);
// Look for MCU with same signature
MCU m = mcus.Find(s => s.signature == detectedSignature);

if (m != null) // Found
{
if (OnDetectedMCU != null)
OnDetectedMCU(this, new DetectedMCUEventArgs(m));
}
else // Not found
{
// TODO: dont write to console here
//m = new MCU(null, null, detectedSignature);
Util.consoleWrite("Unknown signature " + detectedSignature + Environment.NewLine);
}

return;
if (m != null) // Found
{
if (OnDetectedMCU != null)
OnDetectedMCU(this, new DetectedMCUEventArgs(m));
}
else // Not found
{
// TODO: dont write to console here
//m = new MCU(null, null, detectedSignature);
Util.consoleWrite("Unknown signature " + detectedSignature + Environment.NewLine);
}

return;
}
}

0 comments on commit 87016cb

Please sign in to comment.
You can’t perform that action at this time.