aboutsummaryrefslogtreecommitdiffstats
path: root/src/usb-hid.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-05-01 19:59:34 -0400
committerKevin O'Connor <kevin@koconnor.net>2010-05-01 19:59:34 -0400
commitdd5a8a6b0d3c2d8320cb26ea8ac6798091070f9a (patch)
tree4984d73debd8856a39c408a182e839a86766965b /src/usb-hid.c
parent5718d5662d33355403e7aa62227acecac1755a4f (diff)
downloadseabios-dd5a8a6b0d3c2d8320cb26ea8ac6798091070f9a.tar.gz
When USB keyboard active, don't send keyboard commands to ps2 port.
Route keyboard commands to a USB handler when USB keyboard is active. Add a GETID handler for USB keyboards.
Diffstat (limited to 'src/usb-hid.c')
-rw-r--r--src/usb-hid.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/usb-hid.c b/src/usb-hid.c
index f82965d7..bffd81cd 100644
--- a/src/usb-hid.c
+++ b/src/usb-hid.c
@@ -9,6 +9,7 @@
#include "config.h" // CONFIG_*
#include "usb.h" // usb_ctrlrequest
#include "biosvar.h" // GET_GLOBAL
+#include "ps2port.h" // ATKBD_CMD_GETID
struct usb_pipe *keyboard_pipe VAR16VISIBLE;
@@ -252,3 +253,25 @@ usb_check_key(void)
handle_key(&data);
}
}
+
+// Test if USB keyboard is active.
+inline int
+usb_kbd_active(void)
+{
+ return GET_GLOBAL(keyboard_pipe) != NULL;
+}
+
+// Handle a ps2 style keyboard command.
+inline int
+usb_kbd_command(int command, u8 *param)
+{
+ switch (command) {
+ case ATKBD_CMD_GETID:
+ // Return the id of a standard AT keyboard.
+ param[0] = 0xab;
+ param[1] = 0x83;
+ return 0;
+ default:
+ return -1;
+ }
+}