Skip to content

Commit 82fd6fa

Browse files
committed
[alf] Add firmware compatibility check
1 parent 082b052 commit 82fd6fa

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

apps/Alf.cxx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "ReadoutCard/CardDescriptor.h"
2626
#include "ReadoutCard/CardFinder.h"
2727
#include "ReadoutCard/ChannelFactory.h"
28+
#include "ReadoutCard/Exception.h"
29+
#include "ReadoutCard/FirmwareChecker.h"
2830

2931
namespace ip = boost::asio::ip;
3032
namespace po = boost::program_options;
@@ -53,6 +55,9 @@ class Alf : public AliceO2::Common::Program
5355
options.add_options()("dim-dns-node",
5456
po::value<std::string>(&mOptions.dimDnsNode)->default_value(""),
5557
"The DIM DNS node to set the env var if not already set");
58+
options.add_options()("no-fw-check",
59+
po::bool_switch(&mOptions.noFirmwareCheck)->default_value(false),
60+
"Disable firmware compatibility check");
5661
}
5762

5863
virtual void run(const po::variables_map&) override
@@ -89,8 +94,16 @@ class Alf : public AliceO2::Common::Program
8994
std::shared_ptr<roc::BarInterface> bar2;
9095

9196
// Make the RPC services for every card & link
92-
if (card.cardType == roc::CardType::Cru) { //TODO: To be deprecated when findCards supports types
93-
//TODO: What about CRORC ????????
97+
if (card.cardType == roc::CardType::Cru) {
98+
99+
if (!mOptions.noFirmwareCheck) {
100+
try {
101+
roc::FirmwareChecker().checkFirmwareCompatibility(card.pciAddress);
102+
} catch (const roc::Exception& e) {
103+
getWarningLogger() << boost::diagnostic_information(e) << endm;
104+
continue;
105+
}
106+
}
94107

95108
//auto serialMaybe = card.serialNumber.get();
96109
//int serial = serialMaybe ? serialMaybe : fakeSerial++;
@@ -124,6 +137,7 @@ class Alf : public AliceO2::Common::Program
124137
private:
125138
struct OptionsStruct {
126139
std::string dimDnsNode = "";
140+
bool noFirmwareCheck = false;
127141
} mOptions;
128142
};
129143

0 commit comments

Comments
 (0)