Page 1 of 1

Keyboard Scan Code question

Posted: Sat Dec 31, 2011 6:01 pm
by eryjus
Hi,

I am working on a keyboard driver and have an ISR that simply prints the scan codes to the screen so that I can catalog them (and compare against the code here: http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html, taken from the Wiki page: http://wiki.osdev.org/Keyboard). Most of the keys generate scan codes.

My question is that some keys are not generating scan codes that I thought might. For example, the NumLock is not generating a scan code but the NumLock LED turns on and off. However, I do get different scan codes with NumLock on versus off on the numeric keypad.

Another example is the Caps Lock key, which does not generate a scan code, but changes the scan codes for each letter I press ("Fake Shifts").

I think the reason is my development environment and more specifically how I get there. I am running FC15 in a VM, in which I use both Bochs and QEMU to test my OS. I am connecting to that FC15 VM via VNC Viewer from a Windows 7 machine. I suspect that Windows is intercepting the key presses and handling them before they get to my OS. I am just looking for someone with a little more experience to confirm my thoughts, please. Also, other than my own hardware, is there another approach I might have missed for testing these scan codes?

Thanks!

Re: Keyboard Scan Code question

Posted: Sun Jan 01, 2012 1:59 am
by Brendan
Hi,
eryjus wrote:I think the reason is my development environment and more specifically how I get there. I am running FC15 in a VM, in which I use both Bochs and QEMU to test my OS. I am connecting to that FC15 VM via VNC Viewer from a Windows 7 machine. I suspect that Windows is intercepting the key presses and handling them before they get to my OS.
You suspect right - the emulator (Bochs, Qemu) is like a normal application, and can only get whatever the host OS (Windows) tells applications. To make it worse, Bochs (and Qemu too I think) use SDL for portability; so Bochs can only see what SDL tells it, and SDL can only see what Windows tells it.
eryjus wrote:Also, other than my own hardware, is there another approach I might have missed for testing these scan codes?
Someone else's hardware!

Another option might be a something like VMware ESX Server, which runs on bare metal and doesn't need to rely on "lossy abstractions" (although I haven't tried VMware ESX Server and can't guarantee it doesn't have issues of its own).


Cheers,

Brendan

Re: Keyboard Scan Code question

Posted: Sun Jan 01, 2012 6:32 am
by Owen
Brendan wrote:Another option might be a something like VMware ESX Server, which runs on bare metal and doesn't need to rely on "lossy abstractions" (although I haven't tried VMware ESX Server and can't guarantee it doesn't have issues of its own).
ESXi doesn't have any interface for interacting with the guest VMs from the VM host itself; it is completely administered using a remote Windows program.

Re: Keyboard Scan Code question

Posted: Sun Jan 01, 2012 7:11 am
by Brendan
Hi,
Owen wrote:
Brendan wrote:Another option might be a something like VMware ESX Server, which runs on bare metal and doesn't need to rely on "lossy abstractions" (although I haven't tried VMware ESX Server and can't guarantee it doesn't have issues of its own).
ESXi doesn't have any interface for interacting with the guest VMs from the VM host itself; it is completely administered using a remote Windows program.
Doh - I guess VMware ESX/ESXi does have issues (for raw keyboard) too. :oops:


Cheers,

Brendan

Re: Keyboard Scan Code question

Posted: Sun Jan 01, 2012 10:45 am
by eryjus
Thank you for the help. I should have been clear that I am running ESXi. I did try the VMWare console interface and get some better results, but combinations like <ctrl>-<alt>-<f1> are still not seen by the emulator.

Time to dust off my wife's old 386! :roll: Brendan, I guess that qualifies as "someone else's hardware." You cracked me up; I guess I walked right into that one....