blob: 3b5c3f20bd961bae7a16d6fd22e114506f29241b [file] [log] [blame] [edit]
// Copyright 2023 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef RUNTIME_PROBE_UTILS_BUS_UTILS_H_
#define RUNTIME_PROBE_UTILS_BUS_UTILS_H_
#include <optional>
#include <base/files/file_path.h>
#include <base/values.h>
namespace runtime_probe {
// Check if the probed sysfs node is a removable device.
bool IsRemovableBusDevice(const base::Value::Dict& result);
// Probes the bus info from a sysfs device path. This is designed for the
// sysfs subsystem /sys/class/*. For example: /sys/class/net/eth0. This function
// probes the sysfs subsystem /sys/bus/* which is linked to
// `{node_path}/device`. The return values depend on the bus type. This supports
// pci, usb and sdio.
std::optional<base::Value> GetDeviceBusDataFromSysfsNode(
const base::FilePath& node_path);
std::optional<base::Value> GetDeviceBusDataFromSysfsNode(
const base::FilePath& node_path, bool is_fixed);
} // namespace runtime_probe
#endif // RUNTIME_PROBE_UTILS_BUS_UTILS_H_