1818#include < sstream>
1919#include " CommandLineUtilities/Options.h"
2020#include " CommandLineUtilities/Program.h"
21+ #include " Cru/CruBar.h"
2122#include " RocPciDevice.h"
2223#include " ReadoutCard/ChannelFactory.h"
2324#include " ReadoutCard/FirmwareChecker.h"
@@ -54,9 +55,9 @@ class ProgramListCards : public Program
5455 {
5556 std::ostringstream table;
5657
57- auto formatHeader = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s\n " ;
58- auto formatRow = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s\n " ;
59- auto header = (boost::format (formatHeader) % " #" % " Type" % " PCI Addr" % " Serial" % " Endpoint" % " NUMA" % " FW Version" ).str ();
58+ auto formatHeader = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s %-12s \n " ;
59+ auto formatRow = " %-3s %-6s %-10s %-8s %-10s %-5s %-12s %-12s \n " ;
60+ auto header = (boost::format (formatHeader) % " #" % " Type" % " PCI Addr" % " Serial" % " Endpoint" % " NUMA" % " FW Version" % " UL Version " ).str ();
6061 auto lineFat = std::string (header.length (), ' =' ) + ' \n ' ;
6162 auto lineThin = std::string (header.length (), ' -' ) + ' \n ' ;
6263
@@ -73,11 +74,15 @@ class ProgramListCards : public Program
7374 for (const auto & card : cardsFound) {
7475 const std::string na = " n/a" ;
7576 std::string firmware = na;
77+ std::string userLogicVersion = na;
7678 std::string numaNode = std::to_string (card.numaNode );
7779 try {
7880 Parameters params2 = Parameters::makeParameters (card.pciAddress , 2 );
7981 auto bar2 = ChannelFactory ().getBar (params2);
8082 firmware = bar2->getFirmwareInfo ().value_or (na);
83+ if (card.cardType == CardType::type::Cru) {
84+ userLogicVersion = std::dynamic_pointer_cast<CruBar>(bar2)->getUserLogicVersion ().value_or (na);
85+ }
8186 // Check if the firmware is tagged
8287 firmware = FirmwareChecker ().resolveFirmwareTag (firmware);
8388 } catch (const Exception& e) {
@@ -97,7 +102,7 @@ class ProgramListCards : public Program
97102
98103 if (!mOptions .jsonOut ) {
99104 auto format = boost::format (formatRow) % i % CardType::toString (card.cardType ) % card.pciAddress .toString () % serial %
100- endpoint % card.numaNode % firmware;
105+ endpoint % card.numaNode % firmware % userLogicVersion ;
101106
102107 table << format;
103108 std::cout << table.str ();
@@ -113,6 +118,7 @@ class ProgramListCards : public Program
113118 cardNode.put (" endpoint" , endpoint);
114119 cardNode.put (" numa" , std::to_string (card.numaNode ));
115120 cardNode.put (" firmware" , firmware);
121+ cardNode.put (" userLogicVersion" , userLogicVersion);
116122
117123 // add the card node to the tree
118124 root.add_child (std::to_string (i), cardNode);
0 commit comments