For expos which are designed to use the mouse, the mouse is normally enabled when the expo is created. Setting the display comes later, so move the display-related mouse to expo_set_display() Also get the current mouse position if available. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/expo.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 1fb6d6e9417..432e81d3552 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -151,6 +151,17 @@ int expo_set_display(struct expo *exp, struct udevice *dev) exp->display = dev; exp->cons = cons; + if (IS_ENABLED(CONFIG_MOUSE) && exp->mouse_enabled) { + /* + * Tell the mouse driver about the video device for coordinate + * scaling + */ + ret = mouse_set_video(exp->mouse, exp->display); + if (ret) + return log_msg_ret("msv", ret); + mouse_get_pos(exp->mouse, &exp->mouse_pos); + } + return 0; } @@ -189,11 +200,6 @@ int expo_set_mouse_enable(struct expo *exp, bool enable) if (ret) return log_msg_ret("sme", ret); - /* Tell the mouse driver about the video device for coordinate scaling */ - ret = mouse_set_video(exp->mouse, exp->display); - if (ret) - return log_msg_ret("msv", ret); - /* Get mouse pointer image and dimensions */ exp->mouse_ptr = video_image_getptr(riscos_arrow); if (exp->mouse_ptr) { -- 2.43.0