Keyboard Scan Code question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
eryjus
Member
Member
Posts: 286
Joined: Fri Oct 21, 2011 9:47 pm
Libera.chat IRC: eryjus
Location: Tustin, CA USA

Keyboard Scan Code question

Post 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!
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Keyboard Scan Code question

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Keyboard Scan Code question

Post 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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Keyboard Scan Code question

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
eryjus
Member
Member
Posts: 286
Joined: Fri Oct 21, 2011 9:47 pm
Libera.chat IRC: eryjus
Location: Tustin, CA USA

Re: Keyboard Scan Code question

Post 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....
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber
Post Reply