diff options
author | Simon Glass <sjg@chromium.org> | 2024-09-01 16:26:20 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-09-18 13:01:00 -0600 |
commit | bc624321dc358b2d0fb1436533ece68e6422764c (patch) | |
tree | b59d1ebbefeb9c343f6b407f72a789f944226106 /include/usb.h | |
parent | 010c44926386254ce7a6ec20bc75ffd5196be85c (diff) |
dm: usb: Deal with USB keyboard persisting across tests
Clear any USB-keyboard devices before running a unit test, to avoid
using a stale udevice pointer in stdio. Add a long comment to explain
this situation and why this solution seems best, at least for now.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/usb.h')
-rw-r--r-- | include/usb.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/usb.h b/include/usb.h index e37f853482c..be37ed272e1 100644 --- a/include/usb.h +++ b/include/usb.h @@ -1092,4 +1092,16 @@ struct usb_generic_descriptor **usb_emul_find_descriptor( */ void usb_show_tree(void); +/** + * usb_kbd_remove_for_test() - Remove any USB keyboard + * + * This can only be called from test_pre_run(). It removes the USB keyboard from + * the console system so that the USB device can be dropped + */ +#if CONFIG_IS_ENABLED(USB_KEYBOARD) +int usb_kbd_remove_for_test(void); +#else +static inline int usb_kbd_remove_for_test(void) { return 0; } +#endif + #endif /*_USB_H_ */ |