Re: [PATCH] dm: virtio-console: change STDIO BE attribute


Yu Wang
 

On Thu, Jun 30, 2022 at 11:11:13PM +0800, Conghui Chen wrote:
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;
I just googled the OPOST. Looks like the CLOCAL is not performed if
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





Join {acrn-dev@lists.projectacrn.org to automatically receive all group messages.