@@ -127,7 +127,7 @@ int scene_txtin_open(struct scene *scn, struct scene_obj *obj,
return log_msg_ret("cur", -ENOENT);
vidconsole_set_cursor_pos(cons, NULL, txt->obj.bbox.x0, txt->obj.bbox.y0);
- vidconsole_entry_start(cons);
+ vidconsole_entry_start(cons, NULL);
cli_cread_init(&scn->cls, abuf_data(&tin->buf), tin->line_chars);
scn->cls.insert = true;
scn->cls.putch = scene_txtin_putch;
@@ -697,9 +697,9 @@ static int console_truetype_backspace(struct udevice *dev)
return 0;
}
-static int console_truetype_entry_start(struct udevice *dev)
+static int console_truetype_entry_start(struct udevice *dev, void *vctx)
{
- struct console_tt_ctx *ctx = vidconsole_ctx(dev);
+ struct console_tt_ctx *ctx = vctx;
struct vidconsole_ctx *com = &ctx->com;
/* A new input line has start, so clear our history */
@@ -50,13 +50,15 @@ int vidconsole_set_row(struct udevice *dev, uint row, int clr)
return ops->set_row(dev, row, clr);
}
-int vidconsole_entry_start(struct udevice *dev)
+int vidconsole_entry_start(struct udevice *dev, void *ctx)
{
struct vidconsole_ops *ops = vidconsole_get_ops(dev);
+ if (!ctx)
+ ctx = vidconsole_ctx_from_priv(dev_get_uclass_priv(dev));
if (!ops->entry_start)
return -ENOSYS;
- return ops->entry_start(dev);
+ return ops->entry_start(dev, ctx);
}
/* Move backwards one space */
@@ -130,10 +132,10 @@ static char *parsenum(char *s, int *num)
return end;
}
-void vidconsole_set_cursor_pos(struct udevice *dev, void *ctxp, int x, int y)
+void vidconsole_set_cursor_pos(struct udevice *dev, void *vctx, int x, int y)
{
struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
- struct vidconsole_ctx *ctx = ctxp ? ctxp : vidconsole_ctx_from_priv(priv);
+ struct vidconsole_ctx *ctx = vctx ? vctx : vidconsole_ctx_from_priv(priv);
/* Hide cursor at old position if it's visible */
vidconsole_hide_cursor(dev);
@@ -144,7 +146,7 @@ void vidconsole_set_cursor_pos(struct udevice *dev, void *ctxp, int x, int y)
/* make sure not to kern against the previous character */
ctx->last_ch = 0;
- vidconsole_entry_start(dev);
+ vidconsole_entry_start(dev, NULL);
}
/**
@@ -511,7 +513,7 @@ int vidconsole_put_char(struct udevice *dev, char ch)
break;
case '\n':
vidconsole_newline(dev);
- vidconsole_entry_start(dev);
+ vidconsole_entry_start(dev, NULL);
break;
case '\t': /* Tab (8 chars alignment) */
ctx->xcur_frac = ((ctx->xcur_frac / ctx->tab_width_frac)
@@ -278,6 +278,7 @@ struct vidconsole_ops {
* entry_start() - Indicate that text entry is starting afresh
*
* @dev: Device to adjust
+ * @ctx: Vidconsole context to use
* Returns: 0 on success, -ve on error
*
* Consoles which use proportional fonts need to track the position of
@@ -287,7 +288,7 @@ struct vidconsole_ops {
* command). The driver can use this signal to empty its list of
* positions.
*/
- int (*entry_start)(struct udevice *dev);
+ int (*entry_start)(struct udevice *dev, void *ctx);
/**
* backspace() - Handle erasing the last character
@@ -695,8 +696,9 @@ int vidconsole_set_row(struct udevice *dev, uint row, int clr);
* Marks the current cursor position as the start of a line
*
* @dev: Device to adjust
+ * @ctx: vidconsole context to use, or NULL to use the default
*/
-int vidconsole_entry_start(struct udevice *dev);
+int vidconsole_entry_start(struct udevice *dev, void *ctx);
/**
* vidconsole_put_char() - Output a character to the current console position