mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
Kernel+Userland: Add option for duration of /dev/beep producing sound
This commit is contained in:
parent
1b00618fd9
commit
26f96d2a42
6 changed files with 13 additions and 5 deletions
|
@ -149,12 +149,12 @@ namespace Core::System {
|
|||
|
||||
#ifdef AK_OS_SERENITY
|
||||
|
||||
ErrorOr<void> beep(u16 tone)
|
||||
ErrorOr<void> beep(u16 tone, u16 milliseconds_duration)
|
||||
{
|
||||
static Optional<int> beep_fd;
|
||||
if (!beep_fd.has_value())
|
||||
beep_fd = TRY(Core::System::open("/dev/beep"sv, O_RDWR));
|
||||
BeepInstruction instruction { tone };
|
||||
BeepInstruction instruction { tone, milliseconds_duration };
|
||||
TRY(Core::System::write(beep_fd.value(), Span<u8 const>(&instruction, sizeof(BeepInstruction))));
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue