如何找到Ubuntu中的串口?

How to find the serial port in Ubuntu?

我正在使用 CANtact 工具包发送 CAN 消息。以下代码通过以高速率发送标识符为 0 的消息来执行拒绝服务攻击

from canard import can

from canard.hw import cantact

dev = cantact.CantactDev("/dev/cu.usbmodem14511")

dev.start()

while True:

     print(dev.recv())

您需要正确设置串口(本例中为/dev/cu.usbmodem14511)。

如何找到笔记本电脑的串口?我正在使用 Ubuntu 18.04

/dev/ttyACM0。 来自 wiki:

On Linux, no driver is required. Depending on your Linux distribution, CANtact will either appear as /dev/ttyACM# or /dev/ttyUSB#. The # will depend on how many devices are connected.