1 /* 2 // Copyright (c) 2019 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 17 #include "mdrv2.hpp" 18 19 #include <systemd/sd-event.h> 20 21 #include <phosphor-logging/elog-errors.hpp> 22 #include <phosphor-logging/elog.hpp> 23 24 int main(void) 25 { 26 sd_event* events = nullptr; 27 sd_event_default(&events); 28 sdbusplus::bus::bus bus = sdbusplus::bus::new_default(); 29 sdbusplus::server::manager::manager objManager( 30 bus, "/xyz/openbmc_project/inventory"); 31 bus.attach_event(events, SD_EVENT_PRIORITY_NORMAL); 32 bus.request_name("xyz.openbmc_project.Smbios.MDR_V2"); 33 34 phosphor::smbios::MDR_V2 mdrV2(bus, mdrV2Path, events); 35 36 while (true) 37 { 38 int r = sd_event_run(events, (uint64_t)-1); 39 if (r < 0) 40 { 41 phosphor::logging::log<phosphor::logging::level::ERR>( 42 "Failure processing request", 43 phosphor::logging::entry("errno=0x%X", -r)); 44 return -1; 45 } 46 } 47 return 0; 48 } 49