Skip to content

Commit

Permalink
print the primary MAC address in the correct order (byte reversed)
Browse files Browse the repository at this point in the history
the old version reads the MAC address from memory but it is byte reversed. To print it right I just made a simple loop to print each byte in reverse order. This could be done much better.

Signed-off-by: Scott Gustafson <scott@garlicsoftware.com>
  • Loading branch information
scott-42 committed Sep 4, 2012
1 parent 9b9615f commit f6a3993
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/application/cc_flasher.cpp
Expand Up @@ -334,9 +334,14 @@ void CC_Flasher::task_read_mac_address()
ByteVector mac1;
programmer_.unit_mac_address_read(1, mac1);

std::cout << " MAC addresses, primary: "
<< binary_to_hex(&mac0[0], mac0.size(), ":")
<< ", secondary: "
std::cout << " MAC addresses, primary: ";
for(char x = mac0.size() - 1; x >= 0; --x) {
std::cout << binary_to_hex(&mac0[x], 1, ":");
if (x > 0)
std::cout << ":";
}

std::cout << ", secondary: "
<< binary_to_hex(&mac1[0], mac1.size(), ":") << "\n";
}
}
Expand Down

0 comments on commit f6a3993

Please sign in to comment.