libpayload: Reduce verbosity in USB stack
[coreboot.git] / payloads / libpayload / drivers / usb / usbhid.c
index 7c638298da8b0d94882e8ad956cbfbed134630bd..57f60cfe8071f783fed9c4401fe34bd466683965 100644 (file)
@@ -37,9 +37,7 @@ typedef enum { hid_proto_boot = 0, hid_proto_report = 1 } hid_proto;
 enum { hid_boot_proto_none = 0, hid_boot_proto_keyboard =
                1, hid_boot_proto_mouse = 2
 };
-#ifdef USB_DEBUG
 static const char *boot_protos[3] = { "(none)", "keyboard", "mouse" };
-#endif
 enum { GET_REPORT = 0x1, GET_IDLE = 0x2, GET_PROTOCOL = 0x3, SET_REPORT =
                0x9, SET_IDLE = 0xa, SET_PROTOCOL = 0xb
 };
@@ -62,7 +60,7 @@ static int keycount;
 #define KEYBOARD_BUFFER_SIZE 16
 static short keybuffer[KEYBOARD_BUFFER_SIZE];
 
-char *countries[36][2] = {
+const char *countries[36][2] = {
        { "not supported", "us" },
        { "Arabic", "ae" },
        { "Belgian", "be" },
@@ -86,7 +84,7 @@ char *countries[36][2] = {
        { "Persian (Farsi)", "ir" },
        { "Poland", "pl" },
        { "Portuguese", "pt" },
-       { "Russia", "ru" }, 
+       { "Russia", "ru" },
        { "Slovakia", "sl" },
        { "Spanish", "es" },
        { "Swedish", "se" },
@@ -105,13 +103,13 @@ char *countries[36][2] = {
 
 
 struct layout_maps {
-       char *country;
-       short map[4][0x80];
+       const char *country;
+       const short map[4][0x80];
 };
 
-static struct layout_maps *map;
+static const struct layout_maps *map;
 
-static struct layout_maps keyboard_layouts[] = {
+static const struct layout_maps keyboard_layouts[] = {
 // #ifdef CONFIG_PC_KEYBOARD_LAYOUT_US
 { .country = "us", .map = {
        { /* No modifier */
@@ -241,8 +239,8 @@ typedef union {
 #define INITIAL_REPEAT_DELAY   10
 #define REPEAT_DELAY            2
 
-static void 
-usb_hid_process_keyboard_event(usb_hid_keyboard_event_t *current, 
+static void
+usb_hid_process_keyboard_event(usb_hid_keyboard_event_t *current,
                usb_hid_keyboard_event_t *previous)
 {
        int i, keypress = 0, modifiers = 0;
@@ -378,7 +376,7 @@ static struct console_input_driver cons = {
 };
 
 
-int usb_hid_set_layout (char *country)
+static int usb_hid_set_layout (const char *country)
 {
        /* FIXME should be per keyboard */
        int i;
@@ -394,7 +392,7 @@ int usb_hid_set_layout (char *country)
                return 0;
        }
 
-       printf("Keyboard layout '%s' not found, using '%s'\n",
+       printf("  Keyboard layout '%s' not found, using '%s'\n",
                        country, map->country);
 
        /* Nothing found, not changed */
@@ -429,16 +427,16 @@ usb_hid_init (usbdev_t *dev)
                        usb_hid_set_idle(dev, interface, KEYBOARD_REPEAT_MS);
                        debug ("  activating...\n");
 
-                       HID_INST (dev)->descriptor = 
+                       HID_INST (dev)->descriptor =
                                (hid_descriptor_t *)
                                        get_descriptor(dev, gen_bmRequestType
-                                       (device_to_host, standard_type, iface_recp), 
+                                       (device_to_host, standard_type, iface_recp),
                                        0x21, 0, 0);
                        countrycode = HID_INST(dev)->descriptor->bCountryCode;
                        /* 35 countries defined: */
                        if (countrycode > 35)
                                countrycode = 0;
-                       printf ("  Keyboard has %s layout (country code %02x)\n", 
+                       debug ("  Keyboard has %s layout (country code %02x)\n",
                                        countries[countrycode][0], countrycode);
 
                        /* Set keyboard layout accordingly */
@@ -464,7 +462,7 @@ usb_hid_init (usbdev_t *dev)
                        debug ("  configuration done.\n");
                        break;
                case hid_boot_proto_mouse:
-                       printf("NOTICE: USB mice are not supported.\n");
+                       debug("NOTICE: USB mice are not supported.\n");
                        break;
                }
        }