s390/3215: fix tty output containing tabs
commit e512d56c799517f33b301d81e9a5e0ebf30c2d1e upstream.
git commit 37f81fa1f6
"n_tty: do O_ONLCR translation as a single write"
surfaced a bug in the 3215 device driver. In combination this
broke tab expansion for tty ouput.
The cause is an asymmetry in the behaviour of tty3215_ops->write
vs tty3215_ops->put_char. The put_char function scans for '\t'
but the write function does not.
As the driver has logic for the '\t' expansion remove XTABS
from c_oflag of the initial termios as well.
Reported-by: Stephen Powell <zlinuxman@wowway.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
214a899e44
commit
10baac9160
|
@ -1029,12 +1029,26 @@ static int tty3215_write(struct tty_struct * tty,
|
||||||
const unsigned char *buf, int count)
|
const unsigned char *buf, int count)
|
||||||
{
|
{
|
||||||
struct raw3215_info *raw;
|
struct raw3215_info *raw;
|
||||||
|
int i, written;
|
||||||
|
|
||||||
if (!tty)
|
if (!tty)
|
||||||
return 0;
|
return 0;
|
||||||
raw = (struct raw3215_info *) tty->driver_data;
|
raw = (struct raw3215_info *) tty->driver_data;
|
||||||
raw3215_write(raw, buf, count);
|
written = count;
|
||||||
return count;
|
while (count > 0) {
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
if (buf[i] == '\t' || buf[i] == '\n')
|
||||||
|
break;
|
||||||
|
raw3215_write(raw, buf, i);
|
||||||
|
count -= i;
|
||||||
|
buf += i;
|
||||||
|
if (count > 0) {
|
||||||
|
raw3215_putchar(raw, *buf);
|
||||||
|
count--;
|
||||||
|
buf++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1182,7 +1196,7 @@ static int __init tty3215_init(void)
|
||||||
driver->subtype = SYSTEM_TYPE_TTY;
|
driver->subtype = SYSTEM_TYPE_TTY;
|
||||||
driver->init_termios = tty_std_termios;
|
driver->init_termios = tty_std_termios;
|
||||||
driver->init_termios.c_iflag = IGNBRK | IGNPAR;
|
driver->init_termios.c_iflag = IGNBRK | IGNPAR;
|
||||||
driver->init_termios.c_oflag = ONLCR | XTABS;
|
driver->init_termios.c_oflag = ONLCR;
|
||||||
driver->init_termios.c_lflag = ISIG;
|
driver->init_termios.c_lflag = ISIG;
|
||||||
driver->flags = TTY_DRIVER_REAL_RAW;
|
driver->flags = TTY_DRIVER_REAL_RAW;
|
||||||
tty_set_operations(driver, &tty3215_ops);
|
tty_set_operations(driver, &tty3215_ops);
|
||||||
|
|
Loading…
Reference in New Issue