I set scancode set 2 in my PS/2 keyboard initialization code. It's sufficient for most all keys I need to support.
Here is a reference if you need the scancode to character tables. You basically want to look at everything whose label starts with the prefix "ps2", as the first two labels are USB-specific.
CelestialMechanic wrote:
A related question, what about the Fn key that many laptops have?
The Fn key shouldn't send a scancode, and in fact, it doesn't. It merely changes the scancodes that are made by other keys (also known as hotkeys). For example, my laptop has an F1 key with the mute key. When you press it without Fn, it sends a Mute make code. When you release it, it sends a Mute break code. If you press Fn, nothing will happen and the driver will not become aware. When you press Fn
and the mute key, it will send an F1 make code. When you release the mute key then, it will send an F1 break code. So basically, your code doesn't need to be aware of the existence of the Fn key.
Notice that some BIOSes allow you to manipulate the function of the Fn key. For example, my laptop's BIOS allows me to set "hotkey mode" or "function mode." In hotkey mode, pressing one of the keys with an "Fn" mark will send the hotkey scancodes (i.e. mute, volume up, volume down, exit, etc.) Then when you press one of the hotkeys with Fn at the same time, it will send the function scancodes (i.e. F1, F2, F3, F4, etc.) In function mode, this is vice versa. Your OS doesn't need to be aware of this either, and as far as it is concerned, the user either pressed one the "multimedia/ACPI keys" or the one of the "function keys."
CelestialMechanic wrote:
My development system is not a laptop but its keyboard has an Fn key. It does not appear to do anything except gobble up most key presses but there are a few function keys that are not gobbled. Eventually the keyboard stopped working completely and I had to use the mouse to shut down programs and reboot.
Does this happen in your OS, or in your host OS? As far as I'm aware, the Fn/hotkey combinations all work fine under Linux and Windows. What does gobble up the key presses mean?
Just for completeness, are you aware that some keys (probably the multimedia/ACPI keys) have scancodes larger than one byte?