ps2dev icon indicating copy to clipboard operation
ps2dev copied to clipboard

PS/2 Keyboard recognition on PC power ON inconcistency

Open cmarkak opened this issue 3 years ago • 4 comments

Hi,

Many thanks for this great library!

In my computer, M/B and PC case incompatibility prevent it from booting properly unless F1 is pressed in the BIOS.

I use an arduino to press F1 after powering on my computer in order to proceed to booting windows and I would like this to be done remotely with an IoT plug.

Currently, I have two ways of powering on my computer:

  1. With the power button directly, when power is supplied to the computer
  2. With an IoT power plug.

I have managed to make it work when I use the power button (with the IoT plug always on). The builtin led corresponding to num lock lights up, so the keyboard_handle() is working as intended) and the F1 button is emulated successfully, proceeding to boot.

But with the IoT plug, when initially powered off, when I turn it on, it is not working. The builtin led does not go to the on state, indicating a problem in communication.

I run a few tweaks/tests on my own with the library to no avail. I imagine it has to do with the initialization timing in the booting sequence because in the case of the IoT plug, there is a slight delay of about 1 second before the computer boots in comparison the the power on button.

I have tested with a working ps/2 keyboard and it works in both cases.

Some observations from my tests

  • The keyboard_init() function completes in both cases
  • I tried including some delays before and after the keyboard_init() function but no luck, maybe it is a matter of more trials combinations?
  • Initially, the CLK and DATA pins are on 5V in both cases, but in the non-working case, when the write function initiates the CLK pin goes to LOW state. That happens for some reason before the call to the write() function because I have also found with a debugging led that the function exits with code -1 when entering "if (digitalRead(_ps2clk) == LOW) {" block.
  • The keyboard_init() function never completes when the windows is already booted. But to be honest the ps/2 keyboard that otherwise works does not get recognized either so maybe this is not relevant.

Any help or insight on the problem would be highly appreciated.

cmarkak avatar Sep 27 '21 18:09 cmarkak

Been working on PC-Compatibility issues and got progress.

Note that I'm working on an ESP32 fork, as I want to make this Bluetooth enabled.

Check all my findings here: https://github.com/hrko/esp32-ps2dev/pull/1

Hamberthm avatar Apr 15 '23 16:04 Hamberthm

@Hamberthm thanks for fixing the issue and posting the resolution. I had the same issue as @cmarkak : that is I needed to automatically press F1 key during PC start-up because the bios was complaining a fan is not connected. When the PC was started from cold (power was cut completely for 30 seconds) then the PC did not register the F1 key send by this library during boot. OTOH, when I pressed the PC case Power button (not the power switch on the power supply) 2x to shut the PC down, then start it back on, the F1 key was registered and booting continued. Your changes fixed the cold boot issue and now the F1 key is registered by the Bios in both of the cases (cold start and warm start).

ole00 avatar Mar 02 '24 23:03 ole00

Glad it helped!

Hamberthm avatar Mar 03 '24 01:03 Hamberthm

BTW. the modified code for Arduino (compatible with this repo) can be found here: https://github.com/ole00/ps2dev branch: ole-20240302-fix_pc_boot_from_cold

ole00 avatar Mar 03 '24 12:03 ole00