简体   繁体   English

Linux内核tty驱动程序可以在代码中默认关闭echo吗?

[英]linux kernel tty driver can you turn off echo by default in the code?

Related to this question: tty-flip-buffer-push-sends-data-back-to-itself 与此问题有关: tty-flip-buffer-push-sends将数据发送回自身

So I had the same issue, where I have written a driver and in my tty callback code that writes back out of the tty to the user (who is running cat /dev/mytty ). 因此,我遇到了同样的问题,我编写了一个驱动程序,并在我的tty回调代码中将tty的内容写回到了用户(谁在运行cat /dev/mytty )。

When I write to the tty it loops back and cat should print it out. 当我写tty时,它会循环返回,而cat应该将其打印出来。 However since echo it on it goes around in a loop forever. 但是,由于回声,它会永远循环循环。 Entering the command stty -F /dev/mytty -echo fixes that. 输入命令stty -F /dev/mytty -echo解决此问题。

So my question is in my driver code is there a setting that I can change to not default to echo on? 所以我的问题是在我的驱动程序代码中,是否可以更改为不默认以回显的设置? Maybe in the tty_probe(...) or tty_set_operations(...) functinos? 也许在tty_probe(...)tty_set_operations(...)函数中?

您可以在调用tty_set_operations()之前关闭echo,如下所示:

tty_driver->init_termios.c_lflag &= ~ECHO;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM