Page 1 of 1

PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 3:17 am
by adev5311
Im trying to Initialize PS/2 Controller.
Its working properly in QEMU and other emulators,
and I tried in my laptop as my laptop supports CSM and In device manager,
Its displaying Keyboard/Touch pad as PS/2 device. But in my laptop returning 0x1C (After Pressing Enter on Grub) or 0xFA on Self-test. I already added code to Flush buffer and Disable devices.
What should I fix?

Re: PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 3:21 pm
by Octocontrabass
USB legacy support will interfere with initializing the PS/2 controller. If you don't have USB drivers yet, you can try disabling USB legacy support in the BIOS setup.

Which self-test are you talking about? Both the PS/2 controller and the keyboard have self-test commands. (Do not use the PS/2 controller self-test command.)

Sharing your code will help us figure out what's going on.

Re: PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 3:42 pm
by adev5311
I'm using PS/2 Controller self-test, Is there problem?
Why self-test on PS/2 Controller is bad?
(+ There's no option to disable USB legacy support. Its Samsung UEFI BIOS.)

Re: PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 4:08 pm
by Octocontrabass
adev5311 wrote: Sun Oct 13, 2024 3:42 pmI'm using PS/2 Controller self-test, Is there problem?
Why self-test on PS/2 Controller is bad?
The self-test command can change the PS/2 controller configuration. Firmware, especially on laptops, does not handle the change gracefully. For example, laptop Fn keys may stop working or activate when the wrong keys are pressed.

Re: PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 4:52 pm
by adev5311
I reset config after checking self-test.
and after I remove controller self-testing...
First port Test is returning 0x54 (0 for second port)
and Identify command is not working properly in my laptop.

Re: PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 8:27 pm
by Octocontrabass
adev5311 wrote: Sun Oct 13, 2024 4:52 pmI reset config after checking self-test.
You might not be able to reset everything. There are lots of nonstandard extensions to the PS/2 controller.
adev5311 wrote: Sun Oct 13, 2024 4:52 pmFirst port Test is returning 0x54 (0 for second port)
That sounds like the keyboard and mouse IDs. I think there's something wrong in your code to receive data from the PS/2 controller.

Re: PS/2 Self-testing problem

Posted: Sun Oct 13, 2024 11:57 pm
by adev5311
Octocontrabass wrote: Sun Oct 13, 2024 8:27 pm
adev5311 wrote: Sun Oct 13, 2024 4:52 pmI reset config after checking self-test.
You might not be able to reset everything. There are lots of nonstandard extensions to the PS/2 controller.
Sorry, I meant "I'm setting config of PS/2 Controller after self-testing."
Octocontrabass wrote: Sun Oct 13, 2024 8:27 pm
adev5311 wrote: Sun Oct 13, 2024 4:52 pmFirst port Test is returning 0x54 (0 for second port)
That sounds like the keyboard and mouse IDs. I think there's something wrong in your code to receive data from the PS/2 controller.
Probably flushing buffer is not working properly. #-o I'm doing :

Code: Select all

while ((inb(0x64) >> 0) & 1 == 1) inb(0x60)
To flush buffer.

Re: PS/2 Self-testing problem

Posted: Mon Oct 14, 2024 4:03 pm
by Octocontrabass
adev5311 wrote: Sun Oct 13, 2024 11:57 pmSorry, I meant "I'm setting config of PS/2 Controller after self-testing."
You're setting the standard configuration byte. What about nonstandard configurations?
adev5311 wrote: Sun Oct 13, 2024 11:57 pmProbably flushing buffer is not working properly. #-o I'm doing :

Code: Select all

while ((inb(0x64) >> 0) & 1 == 1) inb(0x60)
To flush buffer.
That's the right way to flush the output buffer. Are you flushing the output buffer at the right time?

Re: PS/2 Self-testing problem

Posted: Mon Oct 14, 2024 4:29 pm
by adev5311
Octocontrabass wrote: Mon Oct 14, 2024 4:03 pm
adev5311 wrote: Sun Oct 13, 2024 11:57 pmSorry, I meant "I'm setting config of PS/2 Controller after self-testing."
You're setting the standard configuration byte. What about nonstandard configurations?
Probably that's the Reason.
Octocontrabass wrote: Mon Oct 14, 2024 4:03 pm
adev5311 wrote: Sun Oct 13, 2024 11:57 pmProbably flushing buffer is not working properly. #-o I'm doing :

Code: Select all

while ((inb(0x64) >> 0) & 1 == 1) inb(0x60)
To flush buffer.
That's the right way to flush the output buffer. Are you flushing the output buffer at the right time?
Before disabling devices.

Re: PS/2 Self-testing problem

Posted: Mon Oct 14, 2024 4:37 pm
by Octocontrabass
adev5311 wrote: Mon Oct 14, 2024 4:29 pmBefore disabling devices.
That sounds like the right time to flush the output buffer. You should share your code if it's still not working.