/* * Copyright (c) 2021-2022, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Kernel { class SysFSUSBDeviceInformation : public SysFSComponent { friend class SysFSUSBBusDirectory; public: virtual ~SysFSUSBDeviceInformation() override; static ErrorOr> create(USB::Device&); virtual StringView name() const override { return m_device_name->view(); } RefPtr device() const { return m_device; } protected: SysFSUSBDeviceInformation(NonnullOwnPtr device_name, USB::Device& device); virtual ErrorOr read_bytes(off_t offset, size_t count, UserOrKernelBuffer& buffer, OpenFileDescription*) const override; IntrusiveListNode> m_list_node; NonnullRefPtr m_device; private: ErrorOr try_generate(KBufferBuilder&); virtual ErrorOr refresh_data(OpenFileDescription& description) const override; mutable Mutex m_lock { "SysFSUSBDeviceInformation" }; NonnullOwnPtr m_device_name; }; }