Kernel: Bypass PS2 detection if scancode set is forced
This commit is contained in:
parent
27613da5ea
commit
aebacb6b6a
|
@ -240,12 +240,21 @@ namespace Kernel::Input
|
||||||
|
|
||||||
BAN::ErrorOr<void> PS2Controller::initialize_impl(uint8_t scancode_set)
|
BAN::ErrorOr<void> PS2Controller::initialize_impl(uint8_t scancode_set)
|
||||||
{
|
{
|
||||||
// Determine if the PS/2 Controller Exists
|
constexpr size_t iapc_flag_off = offsetof(ACPI::FADT, iapc_boot_arch);
|
||||||
auto* fadt = static_cast<const ACPI::FADT*>(ACPI::ACPI::get().get_header("FACP"_sv, 0));
|
constexpr size_t iapc_flag_end = iapc_flag_off + sizeof(ACPI::FADT::iapc_boot_arch);
|
||||||
if (fadt && fadt->revision > 1 && !(fadt->iapc_boot_arch & (1 << 1)))
|
|
||||||
|
// If user provided scan code set, skip FADT detection
|
||||||
|
if (scancode_set == 0xFF)
|
||||||
|
scancode_set = 0;
|
||||||
|
else if (scancode_set == 0)
|
||||||
{
|
{
|
||||||
dwarnln_if(DEBUG_PS2, "No PS/2 available");
|
// Determine if the PS/2 Controller Exists
|
||||||
return BAN::Error::from_errno(ENODEV);
|
auto* fadt = static_cast<const ACPI::FADT*>(ACPI::ACPI::get().get_header("FACP"_sv, 0));
|
||||||
|
if (fadt && fadt->revision >= 3 && fadt->length >= iapc_flag_end && !(fadt->iapc_boot_arch & (1 << 1)))
|
||||||
|
{
|
||||||
|
dwarnln_if(DEBUG_PS2, "No PS/2 available");
|
||||||
|
return BAN::Error::from_errno(ENODEV);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable Devices
|
// Disable Devices
|
||||||
|
|
|
@ -91,9 +91,14 @@ static void parse_command_line()
|
||||||
g_disable_debug = true;
|
g_disable_debug = true;
|
||||||
else if (argument.starts_with("ps2="))
|
else if (argument.starts_with("ps2="))
|
||||||
{
|
{
|
||||||
if (argument.size() != 5 || !isdigit(argument[4]))
|
if (argument == "ps2=auto"_sv)
|
||||||
dprintln("Invalid ps2= command line argument format '{}'", argument);
|
cmdline.ps2_override = 0xFF;
|
||||||
cmdline.ps2_override = argument[4] - '0';
|
else
|
||||||
|
{
|
||||||
|
if (argument.size() != 5 || !isdigit(argument[4]))
|
||||||
|
dprintln("Invalid ps2= command line argument format '{}'", argument);
|
||||||
|
cmdline.ps2_override = argument[4] - '0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (argument.size() > 5 && argument.substring(0, 5) == "root=")
|
else if (argument.size() > 5 && argument.substring(0, 5) == "root=")
|
||||||
cmdline.root = argument.substring(5);
|
cmdline.root = argument.substring(5);
|
||||||
|
|
Loading…
Reference in New Issue