* @brief 按 compatible 查找第一个匹配的节点 * @param compatible 要查找的 compatible 字符串 * @return Expected 节点偏移量 */
| 688 | * @return Expected<int> 节点偏移量 |
| 689 | */ |
| 690 | [[nodiscard]] auto FindCompatibleNode(const char* compatible) const |
| 691 | -> Expected<int> { |
| 692 | auto offset = fdt_node_offset_by_compatible(fdt_header_, -1, compatible); |
| 693 | if (offset < 0) { |
| 694 | return std::unexpected(Error(ErrorCode::kFdtNodeNotFound)); |
| 695 | } |
| 696 | return offset; |
| 697 | } |
| 698 | |
| 699 | /** |
| 700 | * @brief 根据 compatible 查找已启用的节点(跳过 status="disabled") |