Skip to content

Commit dee3df6

Browse files
t-8chhcahca
authored andcommitted
s390/sclp_vt220: Convert newlines to CRLF instead of LFCR
According to the VT220 specification the possible character combinations sent on RETURN are only CR or CRLF [0]. The Return key sends either a CR character (0/13) or a CR character (0/13) and an LF character (0/10), depending on the set/reset state of line feed/new line mode (LNM). The sclp/vt220 driver however uses LFCR. This can confuse tools, for example the kunit runner. Link: https://vt100.net/docs/vt220-rm/chapter3.html#S3.2 Fixes: 1da177e ("Linux-2.6.12-rc2") Cc: [email protected] Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Sven Schnelle <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
1 parent 0d9dc27 commit dee3df6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/s390/char/sclp_vt220.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ sclp_vt220_add_msg(struct sclp_vt220_request *request,
319319
buffer = (void *) ((addr_t) sccb + sccb->header.length);
320320

321321
if (convertlf) {
322-
/* Perform Linefeed conversion (0x0a -> 0x0a 0x0d)*/
322+
/* Perform Linefeed conversion (0x0a -> 0x0d 0x0a)*/
323323
for (from=0, to=0;
324324
(from < count) && (to < sclp_vt220_space_left(request));
325325
from++) {
@@ -328,8 +328,8 @@ sclp_vt220_add_msg(struct sclp_vt220_request *request,
328328
/* Perform conversion */
329329
if (c == 0x0a) {
330330
if (to + 1 < sclp_vt220_space_left(request)) {
331-
((unsigned char *) buffer)[to++] = c;
332331
((unsigned char *) buffer)[to++] = 0x0d;
332+
((unsigned char *) buffer)[to++] = c;
333333
} else
334334
break;
335335

0 commit comments

Comments
 (0)