Kernel: Add CommandLine option to disable or enable the PC speaker

By default, we disable the PC speaker as it's quite annoying when using
the text mode console.
This commit is contained in:
Liav A 2022-01-22 12:29:55 +02:00 committed by Linus Groh
commit 69f054616d
Notes: sideshowbarker 2024-07-17 20:24:57 +09:00
5 changed files with 19 additions and 0 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/CommandLine.h>
#include <Kernel/Devices/PCSpeaker.h>
#include <Kernel/Process.h>
@ -12,6 +13,8 @@ namespace Kernel {
ErrorOr<FlatPtr> Process::sys$beep()
{
VERIFY_NO_PROCESS_BIG_LOCK(this);
if (!kernel_command_line().is_pc_speaker_enabled())
return ENODEV;
PCSpeaker::tone_on(440);
auto result = Thread::current()->sleep(Time::from_nanoseconds(200'000'000));
PCSpeaker::tone_off();