1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 11:15:08 +00:00

Kernel+LibKeyboard: Store the keymap name when setting system keymap

This way we can query the kernel to see which keymap is currently in use.
This commit is contained in:
Valtteri Koskivuori 2020-08-06 02:03:32 +03:00 committed by Andreas Kling
parent 8dd0c391e9
commit 00a0e525e6
6 changed files with 32 additions and 6 deletions

View file

@ -56,7 +56,16 @@ int Process::sys$setkeymap(Userspace<const Syscall::SC_setkeymap_params*> user_p
copy_from_user(character_map_data.alt_map, params.alt_map, CHAR_MAP_SIZE * sizeof(u32));
copy_from_user(character_map_data.altgr_map, params.altgr_map, CHAR_MAP_SIZE * sizeof(u32));
KeyboardDevice::the().set_maps(character_map_data);
auto map_name = get_syscall_path_argument(params.map_name);
if (map_name.is_error()) {
return map_name.error();
}
constexpr size_t map_name_max_size = 50;
if (map_name.value().length() > map_name_max_size) {
return -ENAMETOOLONG;
}
KeyboardDevice::the().set_maps(character_map_data, map_name.value());
return 0;
}