#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/console.h>
} else if ( keycode <= USBKBD_KEY_Z ) {
/* Alphabetic keys */
key = ( keycode - USBKBD_KEY_A + 'a' );
- if ( modifiers & USBKBD_CTRL ) {
- key -= ( 'a' - CTRL_A );
- } else if ( ( modifiers & USBKBD_SHIFT ) ||
- ( leds & USBKBD_LED_CAPS_LOCK ) ) {
- key -= ( 'a' - 'A' );
- }
} else if ( keycode <= USBKBD_KEY_0 ) {
/* Numeric key row */
if ( modifiers & USBKBD_SHIFT ) {
if ( keycode < USBKBD_KEY_CAPS_LOCK )
key = key_remap ( key );
+ /* Handle upper/lower case and Ctrl-<key> */
+ if ( islower ( key ) ) {
+ if ( modifiers & USBKBD_CTRL ) {
+ key -= ( 'a' - CTRL_A );
+ } else if ( ( modifiers & USBKBD_SHIFT ) ||
+ ( leds & USBKBD_LED_CAPS_LOCK ) ) {
+ key -= ( 'a' - 'A' );
+ }
+ }
+
return key;
}