串口调试命令

All devices on Unix are mapped to a device file, the serial ports would be /dev/ttyS0 /dev/ttyS1 ... .

First have a look at the permissions on that file, lets assume you are using /dev/ttyS1.

ls -l /dev/ttyS1

You will want read.write access, if this is a shared system then you should consider the security consequences of opening it up for everyone.

chmod o+rw /dev/ttyS1

A very simple crude method to write to the file, would use the simple echo command.

echo -ne '\033[2J' > /dev/ttyS1

and to read

cat -v < /dev/ttyS1

You can have cat running in one terminal, and echo in a 2nd.

If everything is gibberish, then baud rate, bit settings might need setting before you start sending. stty will do that. !! NOTE stty will use stdin as default file descriptor to affect.

Equivilent commands.

stty -speed 19200 < /dev/ttyS1
stty -speed 19200 -f /dev/ttyS1

This might be enough for you to script something and log ? Not sure what you are trying to achieve.

For a more interactive, remembers your default settings approach would be to useminicom it is just a program which does everything I've mentioned so far. (similar to hyperterminal in Windows, you might be familiar).

An intermediate solution, would use a terminal program like screen which will work on a serial device.

screen /dev/ttyS1

man screen man minicom man stty for more information

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值