From 2c435dba7a29833c2f766dda69d2d172f9b13d8a Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 28 Sep 2013 07:23:36 +0200 Subject: [PATCH] CMTDInfo: Add function findMTDNumberFromName() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/859ef920ccbf7f0da8345b398f2cf80d4755b1eb Author: Michael Liebmann Date: 2013-09-28 (Sat, 28 Sep 2013) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/flashtool.cpp | 9 +++++++++ src/system/flashtool.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index 12356e410..8d242a2b8 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -636,6 +636,15 @@ int CMTDInfo::findMTDNumber(const std::string & filename) return -1; } +int CMTDInfo::findMTDNumberFromName(const char* name) +{ + for (int i = 0; i < getMTDCount(); i++) { + if ((std::string)name == getMTDName(i)) + return i; + } + return -1; +} + std::string CMTDInfo::getMTDName(const std::string & filename) { return getMTDName( findMTDNumber(filename) ); diff --git a/src/system/flashtool.h b/src/system/flashtool.h index 1e1fcd625..7b19cb689 100644 --- a/src/system/flashtool.h +++ b/src/system/flashtool.h @@ -131,6 +131,7 @@ class CMTDInfo int getMTDEraseSize( const std::string & filename ); int findMTDNumber(const std::string & filename); + int findMTDNumberFromName(const char* name); std::string findMTDsystem(); };