我想在不借助 Windows 虚拟机的情况下检索 CAN 跟踪 — 因为到目前为止,我只是在 Windows 虚拟机上这样做,PCAN-View
而且这让我很无聊。我有一个[相对较旧的] PeakPCAN-USB我的 Manjaro 笔记本电脑似乎检测到的设备 ( 4.4.17-1-MANJARO #1 SMP PREEMPT Wed Aug 10 19:50:37 UTC 2016 x86_64 GNU/Linux
):
# lsusb
...
Bus 003 Device 027: ID 0c72:000c PEAK System PCAN-USB
# journalctl -b
kernel: usb 3-1: new full-speed USB device number 28 using xhci_hcd
NetworkManager[713]: <info> [1471966456.5989] manager: (can0): new Generic device (/org/freedesktop/NetworkManager/Devices/27)
kernel: peak_usb 3-1:1.0: PEAK-System PCAN-USB adapter hwrev 28 serial FFFFFFFF (1 channel)
kernel: peak_usb 3-1:1.0 can0: attached to PCAN-USB channel 0 (device 255)
mtp-probe[9153]: checking bus 3, device 28: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-1"
mtp-probe[9153]: bus: 3, device: 28 was not an MTP device
例如,我如何(哈哈)使用那个东西以 250 Kbits/sec 的速度获得跟踪?
答案1
在 package 的帮助下,该过程变得非常简单iproute2
。
首先配置 CAN 接口(以 root 身份):
# ip link set can0 up type can bitrate 250000
...然后将流量转储到文本文件中:
$ candump can0 > cantrace.txt
$ candump -tA can0 > cantrace.txt # includes date/time
$ candump ... can0 | tee cantrace.txt # so as to read what's logged