/**************由于Linux会将0x0D认为是回车,所以以下作特别设置,请参考stty命令*********/
//input setting
String command = "stty -F "+comPort+" -icrnl";//translate carriage return to newline
Runtime.getRuntime().exec(command);
//output setting
command = "stty -F "+comPort+" -onlcr";//translate newline to carriage return-newline
Runtime.getRuntime().exec(command);
/******************************************************************************/
本文介绍如何通过执行特定命令来配置Linux系统中的串口通信参数。重点在于如何使用stty命令进行输入和输出设置,包括将回车符转换为换行符及反向转换。
1073

被折叠的 条评论
为什么被折叠?



