}
#endif /* CONFIG_USB_STORAGE */
-static int do_usb_stop_keyboard(int force)
-{
-#if !defined CONFIG_DM_USB && defined CONFIG_USB_KEYBOARD
- if (usb_kbd_deregister(force) != 0) {
- printf("USB not stopped: usbkbd still using USB\n");
- return 1;
- }
-#endif
- return 0;
-}
-
static void do_usb_start(void)
{
bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
/* try to recognize storage devices immediately */
usb_stor_curr_dev = usb_stor_scan(1);
# endif
-#ifndef CONFIG_DM_USB
-# ifdef CONFIG_USB_KEYBOARD
- drv_usb_kbd_init();
-# endif
-#endif /* !CONFIG_DM_USB */
}
#ifdef CONFIG_DM_USB
if (strncmp(argv[1], "reset", 5) == 0) {
printf("resetting USB...\n");
- if (do_usb_stop_keyboard(1) != 0)
- return 1;
usb_stop();
do_usb_start();
return 0;
if (strncmp(argv[1], "stop", 4) == 0) {
if (argc != 2)
console_assign(stdin, "serial");
- if (do_usb_stop_keyboard(0) != 0)
- return 1;
printf("stopping USB..\n");
usb_stop();
return 0;
return 0;
}
-#if !CONFIG_IS_ENABLED(DM_USB)
-/* Search for keyboard and register it if found. */
-int drv_usb_kbd_init(void)
-{
- int error, i;
-
- debug("%s: Probing for keyboard\n", __func__);
- /* Scan all USB Devices */
- for (i = 0; i < USB_MAX_DEVICE; i++) {
- struct usb_device *dev;
-
- /* Get USB device. */
- dev = usb_get_dev_index(i);
- if (!dev)
- break;
-
- if (dev->devnum == -1)
- continue;
-
- error = probe_usb_keyboard(dev);
- if (!error)
- return 1;
- if (error && error != -ENOENT)
- return error;
- }
-
- /* No USB Keyboard found */
- return -1;
-}
-
-/* Deregister the keyboard. */
-int usb_kbd_deregister(int force)
-{
-#if CONFIG_IS_ENABLED(SYS_STDIO_DEREGISTER)
- struct stdio_dev *dev;
- struct usb_device *usb_kbd_dev;
- struct usb_kbd_pdata *data;
-
- dev = stdio_get_by_name(DEVNAME);
- if (dev) {
- usb_kbd_dev = (struct usb_device *)dev->priv;
- data = usb_kbd_dev->privptr;
-#if CONFIG_IS_ENABLED(CONSOLE_MUX)
- if (iomux_replace_device(stdin, DEVNAME, force ? "nulldev" : ""))
- return 1;
-#endif
- if (stdio_deregister_dev(dev, force) != 0)
- return 1;
-#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
- destroy_int_queue(usb_kbd_dev, data->intq);
-#endif
- free(data->new);
- free(data);
- }
-
- return 0;
-#else
- return 1;
-#endif
-}
-
-#endif
-
-#if CONFIG_IS_ENABLED(DM_USB)
-
static int usb_kbd_probe(struct udevice *dev)
{
struct usb_device *udev = dev_get_parent_priv(dev);
};
U_BOOT_USB_DEVICE(usb_kbd, kbd_id_table);
-
-#endif
config USB_KEYBOARD
bool "USB Keyboard support"
- select DM_KEYBOARD if DM_USB
+ depends on DM_USB
+ select DM_KEYBOARD
select SYS_STDIO_DEREGISTER
---help---
Say Y here if you want to use a USB keyboard for U-Boot command line
#endif
-#ifdef CONFIG_USB_KEYBOARD
-
/*
* USB Keyboard reports are 8 bytes in boot protocol.
* Appendix B of HID Device Class Definition 1.11
*/
#define USB_KBD_BOOT_REPORT_SIZE 8
-int drv_usb_kbd_init(void);
-int usb_kbd_deregister(int force);
-
-#endif
-/* routines */
-
/*
* usb_init() - initialize the USB Controllers
*