简体   繁体   English

Windows 和 Linux 中 USB 串口的区别

[英]Difference between USB Serial in Windows and Linux

I bought a Variense VMU931 inertial measurement unit (IMU) for a robotics project at school, and I am struggling to get it to reliably communicate with my laptop in Ubuntu.我在学校为一个机器人项目购买了 Variense VMU931 惯性测量单元 (IMU),我正在努力让它与我在 Ubuntu 中的笔记本电脑进行可靠的通信。 I am using C++ with termios to connect to it using 8n1 no parity blah blah blah.我正在使用带有 termios 的 C++ 来使用 8n1 无奇偶校验等等连接到它。 I've tried EVERY permutation of settings I can think of, and I still cannot reliably send commands to the IMU.我已经尝试了我能想到的所有设置排列,但我仍然无法可靠地向 IMU 发送命令。

I called Variense support and spoke to the engineer that wrote their software, and he said it is a known issue.我打电话给 Variense 支持并与编写他们软件的工程师交谈,他说这是一个已知问题。 Evidently it works perfectly in Windows (and the Windows demo software worked fine with my device), but neither of us is aware of a significant difference between the USB Serial emulation in Windows and in Linux.显然它在 Windows 中运行良好(Windows 演示软件在我的设备上运行良好),但我们都没有意识到 Windows 和 Linux 中的 USB 串行仿真之间的显着差异。

The constructor at the top of this file shows how I am opening and configuring the port:此文件顶部的构造函数显示了我如何打开和配置端口:

https://github.com/jsford/FFAST/blob/master/VMU931/src/vmu.cpp https://github.com/jsford/FFAST/blob/master/VMU931/src/vmu.cpp

Any help would be great.任何帮助都会很棒。 I've been tearing my hair out over this!我一直在为这件事撕心裂肺! Thanks!谢谢!

Use the cu utility for running tests with different parameters.使用cu实用程序运行具有不同参数的测试。

To debug the issue: run the USB packet capture with Wireshark on Linux directly and also on a Windows VM running in VirtualBox/VmWare.要调试问题:直接在 Linux 上以及在 VirtualBox/VmWare 中运行的 Windows VM 上使用 Wireshark 运行 USB 数据包捕获。 Compare the traffic.比较交通。

Check which kernel module is chosen and loaded for that USB device.检查为该 USB 设备选择并加载了哪个内核模块。 Use /sys/ filesystem for that: this virtual fs has information from kernel about what's used.为此使用/sys/文件系统:此虚拟文件系统具有来自内核的有关所用内容的信息。 Also, the lsmod -kind of commands show the kernel module usage.此外, lsmod -kind 命令显示内核模块使用情况。 The driver choice for USB depends on something like <usb-manufacturer-id>:<usb-product-id> . USB 的驱动程序选择取决于诸如<usb-manufacturer-id>:<usb-product-id>

Put some printf s into the kernel module to see where is fails.将一些printf s放入内核模块以查看失败的地方。 Use the DKMS build system for rebuilding the kernel module.使用 DKMS 构建系统来重建内核模块。 There is a config file somewhere in Linux to blacklist/whitelist the kernel modules - useful to make sure that the right one is loaded. Linux 中有一个配置文件可以将内核模块列入黑名单/白名单 - 有助于确保加载正确的模块。

That's what I was doing to fix a driver of an USB-serial device.这就是我为修复 USB 串行设备的驱动程序所做的工作。

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

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