我正在尝试设置 getty 通过串行登录(主要作为实验)。
几乎任何配置都会发生同样的事情。如果我的默认 shell 是bash
,我在登录后会收到以下消息:
-bash: cannot set terminal process group (15297): Inappropriate ioctl for device
-bash: no job control in this shell
然后为了证明它不起作用,我不能使用ctrl+C来停止程序:
$ sleep 30
^C
而且似乎没有发出信号。
这些是我尝试过的配置:
我已经尝试过这两个命令
# copied from raspberry pi:
sudo /sbin/agetty --keep-baud 115200,38400,9600 ttyUSB0 vt220
# something else I read somewhere
sudo getty -L ttyUSB0 9600 vt100
# (I know I'm mixing and matching a lot of differences but the result is the same)
我作为客户端尝试过 screen 和 picocom。
我尝试过使用 rasberry pi 作为服务器,以及两台不同的 ubuntu 笔记本电脑。
我尝试过两个 FTDI、两个 RS-485 USB 适配器,以及 getty 端的内置 RS232 和客户端的 USB RS232。
我还尝试将默认 shell 更改为 sh 和 dash。我没有收到消息,但 ctrl+C 仍然无法按预期工作
有趣的是 - 当树莓派自动配置/dev/ttyAMA0
,并且它完全使用我放置的 getty 命令时,作业控制起作用了!
并且终端设置几乎相同。(实际上除了-iutf8)
以下是 FTDI 连接和 picocom 运行的终端设置:
$ stty -a -F /dev/ttyUSB0
speed 9600 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = <undef>; discard = <undef>; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal
-crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr
-icrnl ixon ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0
tab0 bs0 vt0 ff0
isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase
-tostop -echoprt echoctl echoke -flusho -extproc
$ stty -a -F /dev/ttyUSB1
speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal
-crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr
-icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0
cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase
-tostop -echoprt echoctl echoke -flusho -extproc
我究竟做错了什么?为什么它可以与树莓派上内置串口的内置配置一起使用?