Serial-Port
多埠串列適配器:即使載入了驅動程序也無法工作
我買了這個串口適配器
在linux上debian被辨識
lspci -k 02:00.0 Serial controller: Device 1c00:3253 (rev 10) Subsystem: Device 1c00:3253 Kernel driver in use: serial
setserial 報告 ok
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/serial-getty@.service /etc/systemd/system/serial-getty@ttyS0.service ln -s /etc/systemd/system/serial-getty@ttyS0.service /etc/systemd/system/getty.target.wants/ systemctl daemon-reload systemctl start serial-getty@ttyS0.service cp /lib/systemd/system/serial-getty@.service /etc/systemd/system/serial-getty@ttyS1.service ln -s /etc/systemd/system/serial-getty@ttyS1.service /etc/systemd/system/getty.target.wants/ systemctl daemon-reload systemctl start serial-getty@ttyS1.service
我已經啟用了兩個埠來嘗試但是……沒有一個工作。
Minicom -D
從外部 pc 或內部 pc 不起作用,只報告沒有串列活動的黑色凍結螢幕 我設置了通常的 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 我仍然無法登錄…
找到的解決方案:倒裝電纜!有人倒置了其中一根串列埠電纜。現在按正確順序更換電纜後一切正常無需外部驅動程序