简体   繁体   English

在Linux上通过USB分析串行数据

[英]Analyzing Serial data over USB on Linux

I have a USB to RS232 adapter which I'm currently using to communicate with a legacy device. 我有一个USB转RS232适配器 ,目前正在使用它与旧版设备进行通信。 I want to analyze the data going to and from the legacy device from my Ubuntu machine over USB. 我想分析通过USB从我的Ubuntu机器往返于旧设备的数据。 The adapter is getting detected automatically without installing any driver as shown in lsusb output below: 无需安装任何驱动程序即可自动检测到适配器,如下面的lsusb输出所示:

Bus 006 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

I tried using the USB packet capture in Wireshark, but it shows a bunch of URB_CONTROL, URB_BULK packets which is not showing anything meaningful. 我尝试在Wireshark中使用USB数据包捕获,但是它显示了一堆URB_CONTROL, URB_BULK数据包,但没有显示任何有意义的内容。 So if there are any better utilities available which can capture the USB2Serial data for a Linux system, please let me know. 因此,如果有任何更好的实用程序可以捕获Linux系统的USB2Serial数据,请告诉我。
TIA! TIA!

After trying various methods, I finally got what I needed using strace . 在尝试了各种方法之后,我终于使用strace获得了所需的东西。 The following command helped me capture all the termios settings for the serial port and also all the IOCTL calls after doing some greps on the file handle of the serial port: 在对串行端口的文件句柄进行一些摸索之后,以下命令可帮助我捕获串行端口的所有termios设置以及所有IOCTL调用:

sudo strace -p <pid> -t -v -o dump.txt

This will dump all the system calls that your application makes on Linux into the file dump.txt. 这会将您的应用程序在Linux上进行的所有系统调用都转储到文件dump.txt中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM