提交 9bc30ab8 编写于 作者: M Mans Rullgard 提交者: Miguel Ojeda

auxdisplay: charlcd: fix x/y command parsing

The x/y command parsing has been broken since commit 12995706
("staging: panel: Fixed checkpatch warning about simple_strtoul()").

Commit b34050fa ("auxdisplay: charlcd: Fix and clean up handling of
x/y commands") fixed some problems by rewriting the parsing code,
but also broke things further by removing the check for a complete
command before attempting to parse it.  As a result, parsing is
terminated at the first x or y character.

This reinstates the check for a final semicolon.  Whereas the original
code use strchr(), this is wasteful seeing as the semicolon is always
at the end of the buffer.  Thus check this character directly instead.
Signed-off-by: NMans Rullgard <mans@mansr.com>
Signed-off-by: NMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
上级 40e020c1
...@@ -538,6 +538,9 @@ static inline int handle_lcd_special_code(struct charlcd *lcd) ...@@ -538,6 +538,9 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
} }
case 'x': /* gotoxy : LxXXX[yYYY]; */ case 'x': /* gotoxy : LxXXX[yYYY]; */
case 'y': /* gotoxy : LyYYY[xXXX]; */ case 'y': /* gotoxy : LyYYY[xXXX]; */
if (priv->esc_seq.buf[priv->esc_seq.len - 1] != ';')
break;
/* If the command is valid, move to the new address */ /* If the command is valid, move to the new address */
if (parse_xy(esc, &priv->addr.x, &priv->addr.y)) if (parse_xy(esc, &priv->addr.x, &priv->addr.y))
charlcd_gotoxy(lcd); charlcd_gotoxy(lcd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册