我买了这个串行适配器
在linux上debian被识别
lspci -k
02:00.0 Serial controller: Device 1c00:3253 (rev 10)
Subsystem: Device 1c00:3253
Kernel driver in use: serial
设置串行报告正常
setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16850, Port: 0xe8c0, IRQ: 16
setserial -g /dev/ttyS1
/dev/ttyS1, UART: 16850, Port: 0xe8c8, IRQ: 16
所以我用systemd激活了串行登录
cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]
ln -s /etc/systemd/system/[email protected] /etc/systemd/system/getty.target.wants/
systemctl daemon-reload
systemctl start [email protected]
cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]
ln -s /etc/systemd/system/[email protected] /etc/systemd/system/getty.target.wants/
systemctl daemon-reload
systemctl start [email protected]
我已经启用了两个端口来尝试但是......没有一个起作用。
Minicom -D
从外部电脑或内部电脑不起作用,仅报告黑色冻结屏幕,没有串行活动我已经设置了通常的 9600 8N1,没有软件/硬件控制和软件/硬件控制,但没有任何工作。即使发送经典的 echo 命令也不起作用
echo "proof" > /dev/ttyS0
cat -V < /dev/ttyS0
为什么不起作用?
编辑:在互联网上搜索我发现该板需要一个外部(原文如此!)驱动程序,当然因为他们不更新最新内核编译的代码,所以有点困难
EDIT-2:我发现了一个过时的驱动程序
https://github.com/wd5gnr/WCH4SDriver.git
当然不编译..
root/WCH4SDriver/wch_serial.c: In function ‘ser_wait_modem_status’:
/root/WCH4SDriver/wch_serial.c:1340:9: error: implicit declaration of function ‘signal_pending’; did you mean ‘timer_pending’? [-Werror=implicit-function-declaration]
if (signal_pending(current))
^~~~~~~~~~~~~~
timer_pending
/root/WCH4SDriver/wch_serial.c: In function ‘ser_open’:
/root/WCH4SDriver/wch_serial.c:2109:8: error: ‘struct tty_struct’ has no member named ‘alt_speed’
tty->alt_speed = 0;
^~
/root/WCH4SDriver/wch_serial.c: In function ‘wch_ser_register_ports’:
/root/WCH4SDriver/wch_serial.c:3116:7: error: implicit declaration of function ‘init_timer’; did you mean ‘init_timers’? [-Werror=implicit-function-declaration]
init_timer(&sp->timer);
^~~~~~~~~~
init_timers
/root/WCH4SDriver/wch_serial.c:3118:26: error: assignment to ‘void (*)(struct timer_list *)’ from incompatible pointer type ‘void (*)(long unsigned int)’ [-Werror=incompatible-pointer-types]
sp->timer.function = wch_ser_timeout;
EDIT-3:有了这个指导最后我让驱动程序工作了,驱动程序 wch.ko /dev/ttyWCH0 和 /dev/ttyWCH1 创建了两个新的开发人员,但使用 minicom 我仍然无法登录...
答案1
找到解决方案:倒置电缆安装!有人接反了其中一根串行端口电缆。现在,按照正确的顺序更换电缆后,一切正常,无需外部驱动程序