/* * Copyright (c) 2021, Liav A. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include namespace Kernel { class MouseDevice : public HIDDevice { public: virtual ~MouseDevice() override; // ^CharacterDevice virtual KResultOr read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override; virtual bool can_read(const FileDescription&, size_t) const override; virtual KResultOr write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override; virtual bool can_write(const FileDescription&, size_t) const override { return true; } // ^HIDDevice virtual Type instrument_type() const override { return Type::Mouse; } // ^Device virtual mode_t required_mode() const override { return 0440; } virtual String device_name() const override { return String::formatted("mouse{}", minor()); } protected: MouseDevice(); // ^CharacterDevice virtual const char* class_name() const override { return "MouseDevice"; } mutable SpinLock m_queue_lock; CircularQueue m_queue; }; }