mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
KeyboardSettings+Kernel: Setting to enable Num Lock on login
This commit is contained in:
parent
7fdeb0ec74
commit
ce6658acc1
11 changed files with 58 additions and 1 deletions
|
@ -143,6 +143,7 @@ namespace Kernel {
|
|||
S(getrandom) \
|
||||
S(getkeymap) \
|
||||
S(setkeymap) \
|
||||
S(set_num_lock) \
|
||||
S(clock_gettime) \
|
||||
S(clock_settime) \
|
||||
S(clock_nanosleep) \
|
||||
|
|
|
@ -191,6 +191,7 @@ set(KERNEL_SOURCES
|
|||
Syscalls/mmap.cpp
|
||||
Syscalls/module.cpp
|
||||
Syscalls/mount.cpp
|
||||
Syscalls/num_lock.cpp
|
||||
Syscalls/open.cpp
|
||||
Syscalls/perf_event.cpp
|
||||
Syscalls/pipe.cpp
|
||||
|
|
|
@ -98,6 +98,11 @@ void HIDManagement::set_maps(const Keyboard::CharacterMapData& character_map_dat
|
|||
dbgln("New Character map '{}' passed in by client.", character_map_name);
|
||||
}
|
||||
|
||||
void HIDManagement::set_num_lock(bool on)
|
||||
{
|
||||
m_i8042_controller->keyboard()->set_num_lock(on);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void HIDManagement::enumerate()
|
||||
{
|
||||
// FIXME: When we have USB HID support, we should ensure that we disable
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
const Keyboard::CharacterMap& character_map() const { return m_character_map; }
|
||||
void set_client(KeyboardClient* client) { m_client = client; }
|
||||
void set_maps(const Keyboard::CharacterMapData& character_map, const String& character_map_name);
|
||||
void set_num_lock(bool on);
|
||||
|
||||
private:
|
||||
size_t generate_minor_device_number_for_mouse();
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
m_modifiers &= ~modifier;
|
||||
}
|
||||
|
||||
void set_num_lock(bool on) { m_num_lock_on = on; }
|
||||
|
||||
protected:
|
||||
KeyboardDevice();
|
||||
mutable SpinLock<u8> m_queue_lock;
|
||||
|
|
|
@ -291,6 +291,7 @@ public:
|
|||
KResultOr<FlatPtr> sys$getresuid(Userspace<uid_t*>, Userspace<uid_t*>, Userspace<uid_t*>);
|
||||
KResultOr<FlatPtr> sys$getresgid(Userspace<gid_t*>, Userspace<gid_t*>, Userspace<gid_t*>);
|
||||
KResultOr<FlatPtr> sys$umask(mode_t);
|
||||
KResultOr<FlatPtr> sys$set_num_lock(bool);
|
||||
KResultOr<FlatPtr> sys$open(Userspace<const Syscall::SC_open_params*>);
|
||||
KResultOr<FlatPtr> sys$close(int fd);
|
||||
KResultOr<FlatPtr> sys$read(int fd, Userspace<u8*>, size_t);
|
||||
|
|
18
Kernel/Syscalls/num_lock.cpp
Normal file
18
Kernel/Syscalls/num_lock.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Devices/HID/HIDManagement.h>
|
||||
#include <Kernel/Process.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
KResultOr<FlatPtr> Process::sys$set_num_lock(bool on)
|
||||
{
|
||||
HIDManagement::the().set_num_lock(on);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue