Page 1 of 1

PS/2 ignores 0xF5 (disable command)

Posted: Fri Aug 20, 2021 4:07 am
by 8infy
Hi, I have a problem with this one computer that completely ignores the disable command.

Here's a few things that I know:
1. This computer has xHCI, which I take ownership of from BIOS before touching PS/2.
2. This computer has a Synaptics touchpad (so PS/2 must also be real).
3. I know its not a multiplexed PS/2 controller.
4. My simple test that I made works on 2 other laptops & qemu/vmware.

Here's the test that I tried (in pseudocode):

Code: Select all

disable_all_ports();
enable_port(1);

// sends 0xF5 and waits for ACK
disable_scanning(port1);

for (;;) {
    data = try_to_read_data_with_some_timeout();
    if (!timeout) {
       panic("got data with scanning disabled? %d", data);
    } 
}
On this one laptop I consistently get a panic with the exact scancode that corresponds to that key that I pressed.
Is this a buggy PS/2 implementation? How am I supposed to safely initialize a device if i can get random garbage data at any time?

UPD: I "solved" the problem by rewriting every function to handle garbage bytes correctly.

Re: PS/2 ignores 0xF5 (disable command)

Posted: Fri Aug 20, 2021 8:43 am
by Octocontrabass
8infy wrote:1. This computer has xHCI, which I take ownership of from BIOS before touching PS/2.
It doesn't have any other USB host controllers, right?
8infy wrote:2. This computer has a Synaptics touchpad (so PS/2 must also be real).
Synaptics makes I2C touchpads too. Does ACPI say the PS/2 controller is real?

OSes typically disable scanning only briefly during hardware initialization, so I can imagine no one noticing a buggy keyboard that ignores the command.

Re: PS/2 ignores 0xF5 (disable command)

Posted: Fri Aug 20, 2021 1:03 pm
by 8infy
Octocontrabass wrote: It doesn't have any other USB host controllers, right?
Yep, it's 2 xHCI ports and that's it.
Octocontrabass wrote: Synaptics makes I2C touchpads too. Does ACPI say the PS/2 controller is real?
Good question, I'd have to check
Octocontrabass wrote: OSes typically disable scanning only briefly during hardware initialization, so I can imagine no one noticing a buggy keyboard that ignores the command.
Yeah this seems possible, I was only able to break initialization if I spam the keyboard really hard, might be possible they didn't really test that themselves.