Harvie / ps2dev

Arduino library to emulate PS2 keyboard/mouse
MIT License
114 stars 27 forks source link

PS/2 Keyboard recognition on PC power ON inconcistency #21

Open cmarkak opened 2 years ago

cmarkak commented 2 years ago

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

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

Hamberthm commented 1 year ago

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

ole00 commented 5 months ago

@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).

Hamberthm commented 5 months ago

Glad it helped!

ole00 commented 5 months ago

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