blob: efc193ab83fa37b9c603736a21ec22b754cec297 [file] [log] [blame]
Tom Josephbe703f72017-03-09 12:34:35 +05301#pragma once
Patrick Venture0b02be92018-08-31 11:55:55 -07002
Vernon Maueryeeb0f982019-05-29 16:36:58 -07003#include <boost/system/error_code.hpp>
Yong Li7dc4ac02019-08-23 17:44:32 +08004#include <ipmid/api-types.hpp>
Vernon Maueryeeb0f982019-05-29 16:36:58 -07005#include <ipmid/message.hpp>
Vernon Mauery33250242019-03-12 16:49:26 -07006#include <ipmid/types.hpp>
George Liude1420d2025-03-03 15:14:25 +08007#include <phosphor-logging/lg2.hpp>
William A. Kennington IIIe47fdfb2018-03-15 17:09:28 -07008#include <sdbusplus/server.hpp>
Tom Josephbe703f72017-03-09 12:34:35 +05309
Patrick Williamsfbc6c9d2023-05-10 07:50:16 -050010#include <chrono>
11#include <optional>
12
Tom Josephbe703f72017-03-09 12:34:35 +053013namespace ipmi
14{
15
Kun Yi5dcf41e2019-03-05 14:02:51 -080016using namespace std::literals::chrono_literals;
17
Ratan Guptacc8feb42017-07-25 21:52:10 +053018constexpr auto MAPPER_BUS_NAME = "xyz.openbmc_project.ObjectMapper";
19constexpr auto MAPPER_OBJ = "/xyz/openbmc_project/object_mapper";
20constexpr auto MAPPER_INTF = "xyz.openbmc_project.ObjectMapper";
21
22constexpr auto ROOT = "/";
23constexpr auto HOST_MATCH = "host0";
Ratan Guptacc8feb42017-07-25 21:52:10 +053024
Ratan Guptab8e99552017-07-27 07:07:48 +053025constexpr auto PROP_INTF = "org.freedesktop.DBus.Properties";
26constexpr auto DELETE_INTERFACE = "xyz.openbmc_project.Object.Delete";
Ratan Guptacc8feb42017-07-25 21:52:10 +053027
28constexpr auto METHOD_GET = "Get";
29constexpr auto METHOD_GET_ALL = "GetAll";
30constexpr auto METHOD_SET = "Set";
31
Kun Yi5dcf41e2019-03-05 14:02:51 -080032/* Use a value of 5s which aligns with BT/KCS bridged timeouts, rather
33 * than the default 25s D-Bus timeout. */
34constexpr std::chrono::microseconds IPMI_DBUS_TIMEOUT = 5s;
35
William A. Kennington IIIe47fdfb2018-03-15 17:09:28 -070036/** @class ServiceCache
37 * @brief Caches lookups of service names from the object mapper.
38 * @details Most ipmi commands need to talk to other dbus daemons to perform
39 * their intended actions on the BMC. This usually means they will
40 * first look up the service name providing the interface they
41 * require. This class reduces the number of such calls by caching
42 * the lookup for a specific service.
43 */
Patrick Venture0b02be92018-08-31 11:55:55 -070044class ServiceCache
45{
46 public:
47 /** @brief Creates a new service cache for the given interface
48 * and path.
49 *
50 * @param[in] intf - The interface used for each lookup
51 * @param[in] path - The path used for each lookup
52 */
53 ServiceCache(const std::string& intf, const std::string& path);
54 ServiceCache(std::string&& intf, std::string&& path);
William A. Kennington IIIe47fdfb2018-03-15 17:09:28 -070055
Patrick Venture0b02be92018-08-31 11:55:55 -070056 /** @brief Gets the service name from the cache or does in a
57 * lookup when invalid.
58 *
59 * @param[in] bus - The bus associated with and used for looking
60 * up the service.
61 */
Patrick Williams5d82f472022-07-22 19:26:53 -050062 const std::string& getService(sdbusplus::bus_t& bus);
William A. Kennington IIIe47fdfb2018-03-15 17:09:28 -070063
Patrick Venture0b02be92018-08-31 11:55:55 -070064 /** @brief Invalidates the current service name */
65 void invalidate();
William A. Kennington IIIe47fdfb2018-03-15 17:09:28 -070066
Patrick Venture0b02be92018-08-31 11:55:55 -070067 /** @brief A wrapper around sdbusplus bus.new_method_call
68 *
69 * @param[in] bus - The bus used for calling the method
70 * @param[in] intf - The interface containing the method
71 * @param[in] method - The method name
72 * @return The message containing the method call.
73 */
Patrick Williams5d82f472022-07-22 19:26:53 -050074 sdbusplus::message_t newMethodCall(sdbusplus::bus_t& bus, const char* intf,
75 const char* method);
William A. Kennington III82c173a2018-05-11 16:10:12 -070076
Patrick Venture0b02be92018-08-31 11:55:55 -070077 /** @brief Check to see if the current cache is valid
78 *
79 * @param[in] bus - The bus used for the service lookup
80 * @return True if the cache is valid false otherwise.
81 */
Patrick Williams5d82f472022-07-22 19:26:53 -050082 bool isValid(sdbusplus::bus_t& bus) const;
Patrick Venture0b02be92018-08-31 11:55:55 -070083
84 private:
85 /** @brief DBUS interface provided by the service */
86 const std::string intf;
87 /** @brief DBUS path provided by the service */
88 const std::string path;
89 /** @brief The name of the service if valid */
Vernon Mauery54012502018-11-07 10:17:31 -080090 std::optional<std::string> cachedService;
Patrick Venture0b02be92018-08-31 11:55:55 -070091 /** @brief The name of the bus used in the service lookup */
Vernon Mauery54012502018-11-07 10:17:31 -080092 std::optional<std::string> cachedBusName;
William A. Kennington IIIe47fdfb2018-03-15 17:09:28 -070093};
94
Tom Josephbe703f72017-03-09 12:34:35 +053095/**
96 * @brief Get the DBUS Service name for the input dbus path
97 *
98 * @param[in] bus - DBUS Bus Object
99 * @param[in] intf - DBUS Interface
100 * @param[in] path - DBUS Object Path
101 *
102 */
Patrick Williams5d82f472022-07-22 19:26:53 -0500103std::string getService(sdbusplus::bus_t& bus, const std::string& intf,
Tom Josephbe703f72017-03-09 12:34:35 +0530104 const std::string& path);
Ratan Guptacc8feb42017-07-25 21:52:10 +0530105
George Liu50f186c2024-02-04 16:51:26 +0800106/** @brief Gets the dbus sub tree implementing the given interface.
107 * @param[in] bus - DBUS Bus Object.
108 * @param[in] interfaces - Dbus interface.
109 * @param[in] subtreePath - subtree from where the search should start.
110 * @param[in] depth - Search depth
111 * @return map of object path and service info.
112 */
113ObjectTree getSubTree(sdbusplus::bus_t& bus, const InterfaceList& interface,
114 const std::string& subtreePath = ROOT, int32_t depth = 0);
115
Ratan Guptacc8feb42017-07-25 21:52:10 +0530116/** @brief Gets the dbus object info implementing the given interface
117 * from the given subtree.
Ratan Gupta01d4bd12017-08-07 15:53:25 +0530118 * @param[in] bus - DBUS Bus Object.
Ratan Guptacc8feb42017-07-25 21:52:10 +0530119 * @param[in] interface - Dbus interface.
120 * @param[in] subtreePath - subtree from where the search should start.
121 * @param[in] match - identifier for object.
122 * @return On success returns the object having objectpath and servicename.
123 */
Patrick Williams1318a5e2024-08-16 15:19:54 -0400124DbusObjectInfo getDbusObject(
125 sdbusplus::bus_t& bus, const std::string& interface,
126 const std::string& subtreePath = ROOT, const std::string& match = {});
Ratan Guptacc8feb42017-07-25 21:52:10 +0530127
128/** @brief Gets the value associated with the given object
129 * and the interface.
Ratan Gupta01d4bd12017-08-07 15:53:25 +0530130 * @param[in] bus - DBUS Bus Object.
Ratan Guptacc8feb42017-07-25 21:52:10 +0530131 * @param[in] service - Dbus service name.
132 * @param[in] objPath - Dbus object path.
133 * @param[in] interface - Dbus interface.
134 * @param[in] property - name of the property.
135 * @return On success returns the value of the property.
136 */
Patrick Williams5d82f472022-07-22 19:26:53 -0500137Value getDbusProperty(sdbusplus::bus_t& bus, const std::string& service,
Patrick Venture0b02be92018-08-31 11:55:55 -0700138 const std::string& objPath, const std::string& interface,
Kun Yi5dcf41e2019-03-05 14:02:51 -0800139 const std::string& property,
140 std::chrono::microseconds timeout = IPMI_DBUS_TIMEOUT);
Ratan Guptacc8feb42017-07-25 21:52:10 +0530141
142/** @brief Gets all the properties associated with the given object
143 * and the interface.
Ratan Gupta01d4bd12017-08-07 15:53:25 +0530144 * @param[in] bus - DBUS Bus Object.
Ratan Guptacc8feb42017-07-25 21:52:10 +0530145 * @param[in] service - Dbus service name.
146 * @param[in] objPath - Dbus object path.
147 * @param[in] interface - Dbus interface.
148 * @return On success returns the map of name value pair.
149 */
Patrick Williams1318a5e2024-08-16 15:19:54 -0400150PropertyMap getAllDbusProperties(
151 sdbusplus::bus_t& bus, const std::string& service,
152 const std::string& objPath, const std::string& interface,
153 std::chrono::microseconds timeout = IPMI_DBUS_TIMEOUT);
Ratan Guptacc8feb42017-07-25 21:52:10 +0530154
Dhruvaraj Subhashchandran5c0beec2018-01-23 04:47:06 -0600155/** @brief Gets all managed objects associated with the given object
156 * path and service.
157 * @param[in] bus - D-Bus Bus Object.
158 * @param[in] service - D-Bus service name.
159 * @param[in] objPath - D-Bus object path.
160 * @return On success returns the map of name value pair.
161 */
Patrick Williams5d82f472022-07-22 19:26:53 -0500162ObjectValueTree getManagedObjects(sdbusplus::bus_t& bus,
Patrick Venture0b02be92018-08-31 11:55:55 -0700163 const std::string& service,
164 const std::string& objPath);
Dhruvaraj Subhashchandran5c0beec2018-01-23 04:47:06 -0600165
Ratan Guptacc8feb42017-07-25 21:52:10 +0530166/** @brief Sets the property value of the given object.
Ratan Gupta01d4bd12017-08-07 15:53:25 +0530167 * @param[in] bus - DBUS Bus Object.
Ratan Guptacc8feb42017-07-25 21:52:10 +0530168 * @param[in] service - Dbus service name.
169 * @param[in] objPath - Dbus object path.
170 * @param[in] interface - Dbus interface.
171 * @param[in] property - name of the property.
172 * @param[in] value - value which needs to be set.
173 */
Patrick Williams5d82f472022-07-22 19:26:53 -0500174void setDbusProperty(sdbusplus::bus_t& bus, const std::string& service,
Patrick Venture0b02be92018-08-31 11:55:55 -0700175 const std::string& objPath, const std::string& interface,
Kun Yi5dcf41e2019-03-05 14:02:51 -0800176 const std::string& property, const Value& value,
177 std::chrono::microseconds timeout = IPMI_DBUS_TIMEOUT);
Ratan Guptacc8feb42017-07-25 21:52:10 +0530178
Ratan Guptab8e99552017-07-27 07:07:48 +0530179/** @brief Gets all the dbus objects from the given service root
180 * which matches the object identifier.
181 * @param[in] bus - DBUS Bus Object.
182 * @param[in] serviceRoot - Service root path.
183 * @param[in] interface - Dbus interface.
184 * @param[in] match - Identifier for a path.
185 * @returns map of object path and service info.
186 */
Patrick Williams1318a5e2024-08-16 15:19:54 -0400187ObjectTree getAllDbusObjects(
188 sdbusplus::bus_t& bus, const std::string& serviceRoot,
189 const std::string& interface, const std::string& match = {});
Ratan Guptab8e99552017-07-27 07:07:48 +0530190
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700191/********* Begin co-routine yielding alternatives ***************/
192
193/** @brief Get the D-Bus Service name for the input D-Bus path
194 *
195 * @param[in] ctx - ipmi::Context::ptr
196 * @param[in] intf - D-Bus Interface
197 * @param[in] path - D-Bus Object Path
198 * @param[out] service - requested service name
199 * @return boost error code
200 *
201 */
Patrick Williams69b4c282025-03-03 11:19:13 -0500202boost::system::error_code getService(Context::ptr ctx, const std::string& intf,
203 const std::string& path,
204 std::string& service);
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700205
George Liu50f186c2024-02-04 16:51:26 +0800206/** @brief Gets the dbus sub tree implementing the given interface.
207 * @param[in] ctx - ipmi::Context::ptr
208 * @param[in] bus - DBUS Bus Object.
209 * @param[in] interfaces - Dbus interface.
210 * @param[in] subtreePath - subtree from where the search should start.
211 * @param[in] depth - Search depth
212 * @param[out] objectTree - map of object path and service info.
213 * @return map of object path and service info.
214 */
Patrick Williams1318a5e2024-08-16 15:19:54 -0400215boost::system::error_code getSubTree(
216 Context::ptr ctx, const InterfaceList& interface,
217 const std::string& subtreePath, int32_t depth, ObjectTree& objectTree);
George Liu50f186c2024-02-04 16:51:26 +0800218
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700219/** @brief Gets the D-Bus object info implementing the given interface
220 * from the given subtree.
221 * @param[in] ctx - ipmi::Context::ptr
222 * @param[in] interface - D-Bus interface.
223 * @param[in][optional] subtreePath - subtree from where the search starts.
224 * @param[in][optional] match - identifier for object.
225 * @param[out] D-Bus object with path and service name
226 * @return - boost error code object
227 */
Patrick Williams69b4c282025-03-03 11:19:13 -0500228boost::system::error_code getDbusObject(
229 Context::ptr ctx, const std::string& interface,
230 const std::string& subtreePath, const std::string& match,
231 DbusObjectInfo& dbusObject);
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700232
233// default for ROOT for subtreePath and std::string{} for match
Patrick Williams1318a5e2024-08-16 15:19:54 -0400234static inline boost::system::error_code getDbusObject(
235 Context::ptr ctx, const std::string& interface, DbusObjectInfo& dbusObject)
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700236{
237 return getDbusObject(ctx, interface, ROOT, {}, dbusObject);
238}
239
240// default std::string{} for match
Patrick Williams69b4c282025-03-03 11:19:13 -0500241static inline boost::system::error_code getDbusObject(
242 Context::ptr ctx, const std::string& interface,
243 const std::string& subtreePath, DbusObjectInfo& dbusObject)
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700244{
245 return getDbusObject(ctx, interface, subtreePath, {}, dbusObject);
246}
247
248/** @brief Gets the value associated with the given object
249 * and the interface.
250 * @param[in] ctx - ipmi::Context::ptr
251 * @param[in] service - D-Bus service name.
252 * @param[in] objPath - D-Bus object path.
253 * @param[in] interface - D-Bus interface.
254 * @param[in] property - name of the property.
255 * @param[out] propertyValue - value of the D-Bus property.
256 * @return - boost error code object
257 */
258template <typename Type>
Patrick Williams69b4c282025-03-03 11:19:13 -0500259boost::system::error_code getDbusProperty(
260 Context::ptr ctx, const std::string& service, const std::string& objPath,
261 const std::string& interface, const std::string& property,
262 Type& propertyValue)
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700263{
264 boost::system::error_code ec;
265 auto variant = ctx->bus->yield_method_call<std::variant<Type>>(
266 ctx->yield, ec, service.c_str(), objPath.c_str(), PROP_INTF, METHOD_GET,
267 interface, property);
268 if (!ec)
269 {
270 Type* tmp = std::get_if<Type>(&variant);
271 if (tmp)
272 {
273 propertyValue = *tmp;
274 return ec;
275 }
276 // user requested incorrect type; make an error code for them
277 ec = boost::system::errc::make_error_code(
278 boost::system::errc::invalid_argument);
279 }
280 return ec;
281}
282
283/** @brief Gets all the properties associated with the given object
284 * and the interface.
285 * @param[in] ctx - ipmi::Context::ptr
286 * @param[in] service - D-Bus service name.
287 * @param[in] objPath - D-Bus object path.
288 * @param[in] interface - D-Bus interface.
289 * @param[out] properties - map of name value pair.
290 * @return - boost error code object
291 */
Patrick Williams1318a5e2024-08-16 15:19:54 -0400292boost::system::error_code getAllDbusProperties(
293 Context::ptr ctx, const std::string& service, const std::string& objPath,
294 const std::string& interface, PropertyMap& properties);
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700295
296/** @brief Sets the property value of the given object.
297 * @param[in] ctx - ipmi::Context::ptr
298 * @param[in] service - D-Bus service name.
299 * @param[in] objPath - D-Bus object path.
300 * @param[in] interface - D-Bus interface.
301 * @param[in] property - name of the property.
302 * @param[in] value - value which needs to be set.
303 * @return - boost error code object
304 */
Patrick Williams69b4c282025-03-03 11:19:13 -0500305boost::system::error_code setDbusProperty(
306 Context::ptr ctx, const std::string& service, const std::string& objPath,
307 const std::string& interface, const std::string& property,
308 const Value& value);
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700309
310/** @brief Gets all the D-Bus objects from the given service root
311 * which matches the object identifier.
312 * @param[in] ctx - ipmi::Context::ptr
313 * @param[in] serviceRoot - Service root path.
314 * @param[in] interface - D-Bus interface.
315 * @param[in][optional] match - Identifier for a path.
316 * @param[out] objectree - map of object path and service info.
317 * @return - boost error code object
318 */
Patrick Williams69b4c282025-03-03 11:19:13 -0500319boost::system::error_code getAllDbusObjects(
320 Context::ptr ctx, const std::string& serviceRoot,
321 const std::string& interface, const std::string& match,
322 ObjectTree& objectTree);
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700323
324// default std::string{} for match
Patrick Williams69b4c282025-03-03 11:19:13 -0500325static inline boost::system::error_code getAllDbusObjects(
326 Context::ptr ctx, const std::string& serviceRoot,
327 const std::string& interface, ObjectTree& objectTree)
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700328{
329 return getAllDbusObjects(ctx, serviceRoot, interface, {}, objectTree);
330}
331
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700332/** @brief Gets all managed objects associated with the given object
333 * path and service.
334 * @param[in] ctx - ipmi::Context::ptr
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700335 * @param[in] service - D-Bus service name.
336 * @param[in] objPath - D-Bus object path.
Vernon Maueryfe39ec92020-03-02 13:58:41 -0800337 * @param[out] objects - map of name value pair.
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700338 * @return - boost error code object
339 */
Patrick Williams69b4c282025-03-03 11:19:13 -0500340boost::system::error_code getManagedObjects(
341 Context::ptr ctx, const std::string& service, const std::string& objPath,
342 ObjectValueTree& objects);
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700343
Albert Zhangb53049e2022-04-02 15:39:51 +0800344/** @brief Gets the value associated with the given object
345 * and the interface.
346 * @param[in] ctx - ipmi::Context::ptr
347 * @param[in] service - D-Bus service name.
348 * @param[in] objPath - D-Bus object path.
349 * @param[in] interface - D-Bus interface.
350 * @param[in] method - name of the method.
351 * @return - boost error code object
352 */
353
Patrick Williams1318a5e2024-08-16 15:19:54 -0400354boost::system::error_code callDbusMethod(
355 Context::ptr ctx, const std::string& service, const std::string& objPath,
356 const std::string& interface, const std::string& method);
Albert Zhangb53049e2022-04-02 15:39:51 +0800357
Vernon Maueryeeb0f982019-05-29 16:36:58 -0700358/********* End co-routine yielding alternatives ***************/
359
Vernon Mauerye7e8b812019-10-28 16:00:34 -0700360/** @brief Retrieve the value from map of variants,
361 * returning a default if the key does not exist or the
362 * type of the value does not match the expected type
363 *
364 * @tparam T - type of expected value to return
365 * @param[in] props - D-Bus propery map (Map of variants)
366 * @param[in] name - key name of property to fetch
367 * @param[in] defaultValue - default value to return on error
368 * @return - value from propery map at name, or defaultValue
369 */
370template <typename T>
371T mappedVariant(const ipmi::PropertyMap& props, const std::string& name,
372 const T& defaultValue)
373{
374 auto item = props.find(name);
375 if (item == props.end())
376 {
377 return defaultValue;
378 }
379 const T* prop = std::get_if<T>(&item->second);
380 if (!prop)
381 {
382 return defaultValue;
383 }
384 return *prop;
385}
386
James Feist1e121122018-07-31 11:44:09 -0700387/** @struct VariantToDoubleVisitor
388 * @brief Visitor to convert variants to doubles
389 * @details Performs a static cast on the underlying type
390 */
391struct VariantToDoubleVisitor
392{
393 template <typename T>
Patrick Williams69b4c282025-03-03 11:19:13 -0500394 std::enable_if_t<std::is_arithmetic<T>::value, double> operator()(
395 const T& t) const
James Feist1e121122018-07-31 11:44:09 -0700396 {
397 return static_cast<double>(t);
398 }
399
400 template <typename T>
Patrick Williams69b4c282025-03-03 11:19:13 -0500401 std::enable_if_t<!std::is_arithmetic<T>::value, double> operator()(
402 const T&) const
James Feist1e121122018-07-31 11:44:09 -0700403 {
404 throw std::invalid_argument("Cannot translate type to double");
405 }
406};
407
Ratan Guptab8e99552017-07-27 07:07:48 +0530408namespace method_no_args
409{
410
411/** @brief Calls the Dbus method which waits for response.
412 * @param[in] bus - DBUS Bus Object.
413 * @param[in] service - Dbus service name.
414 * @param[in] objPath - Dbus object path.
415 * @param[in] interface - Dbus interface.
416 * @param[in] method - Dbus method.
417 */
Patrick Williams5d82f472022-07-22 19:26:53 -0500418void callDbusMethod(sdbusplus::bus_t& bus, const std::string& service,
Patrick Venture0b02be92018-08-31 11:55:55 -0700419 const std::string& objPath, const std::string& interface,
Ratan Guptab8e99552017-07-27 07:07:48 +0530420 const std::string& method);
421
Patrick Venture0b02be92018-08-31 11:55:55 -0700422} // namespace method_no_args
Ratan Guptab8e99552017-07-27 07:07:48 +0530423
George Liude1420d2025-03-03 15:14:25 +0800424template <typename... InputArgs>
425boost::system::error_code callDbusMethod(
426 ipmi::Context::ptr ctx, const std::string& service,
427 const std::string& objPath, const std::string& interface,
428 const std::string& method, const InputArgs&... args)
429{
430 boost::system::error_code ec;
431 ctx->bus->yield_method_call(ctx->yield, ec, service, objPath, interface,
432 method, args...);
433
434 return ec;
435}
436
437template <typename RetType, typename... InputArgs>
438RetType callDbusMethod(ipmi::Context::ptr ctx, boost::system::error_code& ec,
439 const std::string& service, const std::string& objPath,
440 const std::string& interface, const std::string& method,
441 const InputArgs&... args)
442{
443 auto rc = ctx->bus->yield_method_call<RetType>(
444 ctx->yield, ec, service, objPath, interface, method, args...);
445
446 return rc;
447}
448
Yong Li7dc4ac02019-08-23 17:44:32 +0800449/** @brief Perform the low-level i2c bus write-read.
450 * @param[in] i2cBus - i2c bus device node name, such as /dev/i2c-2.
Matt Simmering68d9d402023-11-09 14:22:11 -0800451 * @param[in] targetAddr - i2c device target address.
Yong Li7dc4ac02019-08-23 17:44:32 +0800452 * @param[in] writeData - The data written to i2c device.
453 * @param[out] readBuf - Data read from the i2c device.
454 */
Matt Simmering68d9d402023-11-09 14:22:11 -0800455ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t targetAddr,
Yong Li7dc4ac02019-08-23 17:44:32 +0800456 std::vector<uint8_t> writeData,
457 std::vector<uint8_t>& readBuf);
Tom Josephbe703f72017-03-09 12:34:35 +0530458} // namespace ipmi