Date
1 - 3 of 3
[PATCH] dm: virtio-console: change STDIO BE attribute
Conghui Chen
Fix the log format problem in devicemodel when using virtio-console with
'stdio' configuration.
In virtio-console, it will change the STDIO's attributes, and will case
the log message after that not align.
e.g:
for (i=0; i<3; i++)
printf('test\n');
The original output would be like this:
test
test
test
After add 'OPOST' to oflag of STDIO, the output would be like this:
test
test
test
(OPOST - Enable implementation-defined output processing)
Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio_console.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/devicemodel/hw/pci/virtio/virtio_console.c b/devicemodel/hw/pci/virtio/virtio_console.c
index d3b0fb857..a55284f02 100644
--- a/devicemodel/hw/pci/virtio/virtio_console.c
+++ b/devicemodel/hw/pci/virtio/virtio_console.c
@@ -746,6 +746,7 @@ virtio_console_config_backend(struct virtio_console_backend *be)
saved_tio = tio;
cfmakeraw(&tio);
tio.c_cflag |= CLOCAL;
+ tio.c_oflag |= OPOST;
tcsetattr(fd, TCSANOW, &tio);
if (be->be_type == VIRTIO_CONSOLE_BE_STDIO) {
--
2.25.1
'stdio' configuration.
In virtio-console, it will change the STDIO's attributes, and will case
the log message after that not align.
e.g:
for (i=0; i<3; i++)
printf('test\n');
The original output would be like this:
test
test
test
After add 'OPOST' to oflag of STDIO, the output would be like this:
test
test
test
(OPOST - Enable implementation-defined output processing)
Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio_console.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/devicemodel/hw/pci/virtio/virtio_console.c b/devicemodel/hw/pci/virtio/virtio_console.c
index d3b0fb857..a55284f02 100644
--- a/devicemodel/hw/pci/virtio/virtio_console.c
+++ b/devicemodel/hw/pci/virtio/virtio_console.c
@@ -746,6 +746,7 @@ virtio_console_config_backend(struct virtio_console_backend *be)
saved_tio = tio;
cfmakeraw(&tio);
tio.c_cflag |= CLOCAL;
+ tio.c_oflag |= OPOST;
tcsetattr(fd, TCSANOW, &tio);
if (be->be_type == VIRTIO_CONSOLE_BE_STDIO) {
--
2.25.1
Yu Wang
On Thu, Jun 30, 2022 at 11:11:13PM +0800, Conghui Chen wrote:
OPOST is not set.
https://www.mkssoftware.com/docs/man5/struct_termios.5.asp
Can you please try to double confirm the behavior? Set OPOST but remove
the CLOCAL?
Fix the log format problem in devicemodel when using virtio-console withI just googled the OPOST. Looks like the CLOCAL is not performed if
'stdio' configuration.
In virtio-console, it will change the STDIO's attributes, and will case
the log message after that not align.
e.g:
for (i=0; i<3; i++)
printf('test\n');
The original output would be like this:
test
test
test
After add 'OPOST' to oflag of STDIO, the output would be like this:
test
test
test
(OPOST - Enable implementation-defined output processing)
Signed-off-by: Conghui <conghui.chen@...>
---
devicemodel/hw/pci/virtio/virtio_console.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/devicemodel/hw/pci/virtio/virtio_console.c b/devicemodel/hw/pci/virtio/virtio_console.c
index d3b0fb857..a55284f02 100644
--- a/devicemodel/hw/pci/virtio/virtio_console.c
+++ b/devicemodel/hw/pci/virtio/virtio_console.c
@@ -746,6 +746,7 @@ virtio_console_config_backend(struct virtio_console_backend *be)
saved_tio = tio;
cfmakeraw(&tio);
tio.c_cflag |= CLOCAL;
+ tio.c_oflag |= OPOST;
OPOST is not set.
https://www.mkssoftware.com/docs/man5/struct_termios.5.asp
Can you please try to double confirm the behavior? Set OPOST but remove
the CLOCAL?
tcsetattr(fd, TCSANOW, &tio);
if (be->be_type == VIRTIO_CONSOLE_BE_STDIO) {
--
2.25.1
Conghui Chen
Hi Yu,
Besides, The CLOCAL is used to configurate the connection mode, should has no relationship with the output format.
https://www.mkssoftware.com/docs/man5/struct_termios.5.aspI removed the CLOCAL, and it has no effect on the alignment issue.
Can you please try to double confirm the behavior? Set OPOST but remove
the CLOCAL?
Besides, The CLOCAL is used to configurate the connection mode, should has no relationship with the output format.
tcsetattr(fd, TCSANOW, &tio);
if (be->be_type == VIRTIO_CONSOLE_BE_STDIO) {
--
2.25.1