diff --git a/common/include/villas/kernel/devices/platform_driver.hpp b/common/include/villas/kernel/devices/platform_driver.hpp deleted file mode 100644 index c0f4e4017..000000000 --- a/common/include/villas/kernel/devices/platform_driver.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* PlatformDriver - * - * Author: Pascal Bauer - * - * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include -#include -#include -#include - -namespace villas { -namespace kernel { -namespace devices { - -class PlatformDriver : public Driver { -private: - static constexpr char BIND_DEFAULT[] = "bind"; - static constexpr char UNBIND_DEFAULT[] = "unbind"; - -public: - const std::filesystem::path path; - -private: - const std::filesystem::path bind_path; - const std::filesystem::path unbind_path; - -public: - PlatformDriver(const std::filesystem::path path) - : PlatformDriver(path, path / std::filesystem::path(BIND_DEFAULT), - path / std::filesystem::path(UNBIND_DEFAULT)){}; - - PlatformDriver(const std::filesystem::path path, - const std::filesystem::path bind_path, - const std::filesystem::path unbind_path) - : path(path), bind_path(bind_path), unbind_path(unbind_path){}; - -public: - std::string name() const override; - void attach(const Device &device) const override; - void bind(const Device &device) const override; - void unbind(const Device &device) const override; - void override(const Device &device) const override; -}; - -} // namespace devices -} // namespace kernel -} // namespace villas \ No newline at end of file diff --git a/common/lib/kernel/devices/platform_driver.cpp b/common/lib/kernel/devices/platform_driver.cpp deleted file mode 100644 index 2b03025fe..000000000 --- a/common/lib/kernel/devices/platform_driver.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* PlatformDriver - * - * Author: Pascal Bauer - * - * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#include -#include - -using villas::kernel::devices::Device, villas::kernel::devices::PlatformDriver; -using villas::kernel::devices::utils::write_to_file; - -std::string PlatformDriver::name() const { - size_t pos = path.u8string().rfind('/'); - return path.u8string().substr(pos + 1); -} - -void PlatformDriver::bind(const Device &device) const { - write_to_file(device.name(), this->bind_path); -}; - -void PlatformDriver::unbind(const Device &device) const { - write_to_file(device.name(), this->unbind_path); -}; - -void PlatformDriver::override(const Device &device) const { - write_to_file(this->name(), device.override_path()); -}; - -void PlatformDriver::attach(const Device &device) const { - if (device.driver().has_value()) { - device.driver().value()->unbind(device); - } - this->override(device); - device.probe(); -}; \ No newline at end of file