PS/2 ignores 0xF5 (disable command)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

PS/2 ignores 0xF5 (disable command)

Post 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.
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

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

Post 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.
8infy
Member
Member
Posts: 185
Joined: Sun Apr 05, 2020 1:01 pm

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

Post 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.
Post Reply