1 #include "writefrudata.hpp" 2 3 #include <CLI/CLI.hpp> 4 #include <phosphor-logging/log.hpp> 5 6 #include <cstdlib> 7 #include <cstring> 8 #include <iostream> 9 #include <memory> 10 11 using namespace phosphor::logging; 12 13 //-------------------------------------------------------------------------- 14 // This gets called by udev monitor soon after seeing hog plugs for EEPROMS. 15 //-------------------------------------------------------------------------- 16 int main(int argc, char** argv) 17 { 18 int rc = 0; 19 uint8_t fruid; 20 std::string eeprom_file; 21 const int MAX_FRU_ID = 0xfe; 22 23 CLI::App app{"OpenBMC IPMI-FRU-Parser"}; 24 app.add_option("-e,--eeprom", eeprom_file, "Absolute file name of eeprom") 25 ->check(CLI::ExistingFile); 26 app.add_option("-f,--fruid", fruid, "valid fru id in integer") 27 ->check(CLI::Range(0, MAX_FRU_ID)); 28 29 // Read the arguments. 30 CLI11_PARSE(app, argc, argv); 31 32 // Now that we have the file that contains the eeprom data, go read it 33 // and update the Inventory DB. 34 auto bus = sdbusplus::bus::new_default(); 35 bool bmc_fru = true; 36 rc = validateFRUArea(fruid, eeprom_file.c_str(), bus, bmc_fru); 37 38 return (rc < 0 ? EXIT_FAILURE : EXIT_SUCCESS); 39 } 40