OSDev.org https://forum.osdev.org/ |
|
Can't set PS/2 scancode set in Virtualbox https://forum.osdev.org/viewtopic.php?f=1&t=32929 |
Page 1 of 1 |
Author: | qookie [ Fri May 11, 2018 8:45 am ] |
Post subject: | Can't set PS/2 scancode set in Virtualbox |
Hi. I'm working on my OS and I ran into a problem. When trying to set the scancode set to 1 using the following code: Code: outb(0x60, 0xF0); VirtualBox seems to ignore it completly and keeps using the scancode set 2. The code works correctly in QEMU and on real hardware and I can correctly set the scancode set. I also checked the current keyboard scancode set and it remains at 2 on VirtualBox. Does anyone know how to fix that issue? Or is it something to do with VirtualBox? outb(0x60, 0x01); Thanks for help in advance. qookie |
Author: | Octocontrabass [ Fri May 11, 2018 9:57 am ] |
Post subject: | Re: Can't set PS/2 scancode set in Virtualbox |
Why are you trying to use scan code set 1? Every real OS uses scan code set 2, so it's possible VirtualBox simply can't handle set 1. qookie wrote: The code works correctly [...] on real hardware I'm surprised it works on real hardware, since you're not waiting for the keyboard controller to be ready before you send each byte. Actually, the hardware you're using probably doesn't have a "real" keyboard controller, since it should take hundreds of microseconds to send a single byte to the keyboard, and a "real" keyboard controller can't accept another byte while it sends the first one. Since you're able to get the scan code set but not set it, the lack of appropriate delays is probably not why VirtualBox doesn't work - but emulators are known to be inaccurate, so it's still a possibility. |
Author: | qookie [ Fri May 11, 2018 11:10 am ] |
Post subject: | Re: Can't set PS/2 scancode set in Virtualbox |
I have ommited the calls to wait function in the code snippet. I wait for the input buffer to be empty before sending each byte and waiting for the output buffer to be full to read bytes from the keyboard. Probably should have put the calls to wait functions in the code to make it clearer. |
Author: | Brendan [ Sat May 12, 2018 3:28 am ] |
Post subject: | Re: Can't set PS/2 scancode set in Virtualbox |
Hi, qookie wrote: VirtualBox seems to ignore it completly and keeps using the scancode set 2. The code works correctly in QEMU and on real hardware and I can correctly set the scancode set. I also checked the current keyboard scancode set and it remains at 2 on VirtualBox. Does anyone know how to fix that issue? Or is it something to do with VirtualBox? All real keyboards (since "IBM Personal System/2" was released in the 1980s) support scancode set 2, but there's no guarantee that a keyboard will support any other scan code set. If a keyboard doesn't support a scancode set then it may pretend that the command worked but do nothing. VirtualBox is correctly emulating a real keyboard that doesn't support scancode set 1 - there's no bug in VirtualBox. To fix the issue, you can:
Cheers, Brendan |
Author: | qookie [ Sat May 12, 2018 5:25 am ] |
Post subject: | Re: Can't set PS/2 scancode set in Virtualbox |
Thank you for your answers Brendan and Octocontrabass. I think I'll start using the scancode set 2 to fix the problem. I also had no idea keyboards don't need to support the scancode set 1, so thanks for letting me know! |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |