diff options
author | Lars Poeschel <poeschel@lemonage.de> | 2020-11-03 10:58:26 +0100 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2020-11-04 11:04:05 +0100 |
commit | af9470b26dc6c3a8f9ef460c90e34a66ce4f5f1d (patch) | |
tree | 2851f82a06b72e90468dddea2c2fbd1b239f3167 | |
parent | 40c2b72e4b11f0a80dff19b539fccf36472dc417 (diff) | |
download | linux-af9470b26dc6c3a8f9ef460c90e34a66ce4f5f1d.tar.bz2 |
auxdisplay: charlcd: Do not print chars at end of line
Skip printing characters at the end of a display line. This fits to the
behaviour we already had, that the cursor is nailed to the last position
of a line.
This might slightly change behaviour.
On hd44780 displays with one or two lines the previous implementation
did still write characters to the buffer of the display even if they are
currently not visible. The shift_display command could be used to set
the "viewing window" to a new position in the buffer and then you could
see the characters previously written.
This described behaviour does not work for hd44780 displays with more
than two display lines. There simply is not enough buffer.
So the behaviour was a bit inconsistent across different displays.
The new behaviour is to stop writing characters at the end of a visible
line, even if there would be room in the buffer. This allows us to have
an easy implementation, that should behave equal on all supported
displays. This is not hd44780 hardware dependent anymore.
Reviewed-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-rw-r--r-- | drivers/auxdisplay/charlcd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c index ef10b5ca0e16..f43430e9dcee 100644 --- a/drivers/auxdisplay/charlcd.c +++ b/drivers/auxdisplay/charlcd.c @@ -111,6 +111,9 @@ static void charlcd_home(struct charlcd *lcd) static void charlcd_print(struct charlcd *lcd, char c) { + if (lcd->addr.x >= lcd->width) + return; + if (lcd->char_conv) c = lcd->char_conv[(unsigned char)c]; |