1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

KeyboardPreferenceLoader: Use Core::System::ioctl()

This commit is contained in:
Andreas Kling 2021-11-29 23:09:43 +01:00
parent fd2ea6923c
commit 2b0c2360bb

View file

@ -34,14 +34,8 @@ ErrorOr<int> serenity_main(Main::Arguments)
}
bool enable_num_lock = keyboard_settings_config->read_bool_entry("StartupEnable", "NumLock", true);
auto keyboard_device = TRY(Core::File::open("/dev/keyboard0", Core::OpenMode::ReadOnly));
int rc = ioctl(keyboard_device->fd(), KEYBOARD_IOCTL_SET_NUM_LOCK, enable_num_lock);
if (rc < 0) {
perror("ioctl(KEYBOARD_IOCTL_SET_NUM_LOCK)");
return 1;
}
TRY(Core::System::ioctl(keyboard_device->fd(), KEYBOARD_IOCTL_SET_NUM_LOCK, enable_num_lock));
return 0;
}