MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / find_ethernet_device_name

Function find_ethernet_device_name

OpenHD/ohd_interface/src/ethernet_manager.cpp:127–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127static std::optional<std::string> find_ethernet_device_name() {
128 auto devices = OHDFilesystemUtil::getAllEntriesFilenameOnlyInDirectory(
129 "/sys/class/net/");
130 for (auto& device : devices) {
131 if (OHDUtil::startsWith(device, "enx") ||
132 OHDUtil::startsWith(device, "eth") ||
133 OHDUtil::startsWith(device, "enp")) {
134 return device;
135 }
136 }
137 return std::nullopt;
138}
139
140EthernetManager::EthernetManager() {
141 m_console = openhd::log::create_or_get("eth_manager");

Callers 1

loopMethod · 0.85

Calls 1

startsWithFunction · 0.85

Tested by

no test coverage detected