This patch removes most of the #ifdefs in libc/console.c, and
[coreboot.git] / payloads / libpayload / drivers / usb / usbhid.c
index 8713cf48c8429e1dc3916d4ff83ac7e99815edf1..b96bfe63f566040522babc7c413aa081f421d9df 100644 (file)
@@ -145,10 +145,21 @@ usb_hid_set_protocol (usbdev_t *dev, interface_descriptor_t *interface, hid_prot
        dev->controller->control (dev, OUT, sizeof (dev_req_t), &dr, 0, 0);
 }
 
+static struct console_input_driver cons = {
+       .havekey = usbhid_havechar,
+       .getchar = usbhid_getchar
+};
+
 void
 usb_hid_init (usbdev_t *dev)
 {
 
+       static int installed = 0;
+       if (!installed) {
+               installed = 1;
+               console_add_input_driver (&cons);
+       }
+
        configuration_descriptor_t *cd = (configuration_descriptor_t*)dev->configuration;
        interface_descriptor_t *interface = (interface_descriptor_t*)(((char *) cd) + cd->bLength);