如何模拟USB设备?

发布于 2024-08-15 11:03:59 字数 623 浏览 9 评论 0原文

我团队的其他成员将为我的应用程序制作一个简单的非标准 USB 麦克风,但在他们完成之前,我将不得不模拟它,以进行集成测试。

  1. 物理环回有任何风险吗? 是的
  2. 物理环回会起作用吗? 仅适用于 USB
  3. 有任何方法可以创建逻辑环回? (MSDN 有相关内容
  4. 有任何通用 USB 仿真器软件?

如果有很多可用选项,我宁愿使用 .NET/Matlab/Python 解决方案。

The rest of my team will make for my application a simple non-standard USB microphone, but until they finish it I will have to emulate it, for integration testing purposes.

  1. Is there any risk in a physical loopback? Yes there is
  2. Will a physical loopback work? Only with a USB bridge
  3. There is any way to create a logical loopback? (MSDN has something about this)
  4. There is any general purpose USB emulator software?

In case there is many options available I'd rather work it .NET/Matlab/Python solutions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尤怨 2024-08-22 11:03:59

编辑:概念证明此处

我强烈推荐此项目,USB IP。它是一种通过网络连接 USB 设备的方式。有一个 Windows 客户端。

这意味着,您在 Windows 计算机上安装客户端。
然后,该设备期望与连接到 Linux 计算机(服务器)的 USB 设备进行通信:
USB IP 客户端如何连接到 USB IP 服务器的图表

您现在要做的就是两者之一 为 Linux 创建一个假设备驱动程序,看起来像是连接到物理 USB 设备,但实际上只是假装是您的 USB 设备的逻辑。有为 Linux 编写 USB 驱动程序的教程或者您为设备控制管理器创建自己的存根驱动程序(参见上图)。这个存根驱动程序可以在 Windows 或 Linux 上运行,这并不重要。它甚至可以在作为 USB 客户端的同一台 Windows 计算机上运行。

问题本身提到的 DSF USB Loopback Device 将是与设备控制管理器的存根驱动程序相同类型的解决方案,但完全将 Linux 排除在外。

Edit: Proof of concept here

I strongly recommend this project, USB IP. It is a way of connecting USB devices over the network. There is a Windows client.

What this means is, you install the client on your Windows computer.
This device then expects to talk to a USB device connected to a Linux computer, the server:
diagram over how a USB IP client connects to a USB IP server

What you now do, is either create a fake device driver for Linux, that looks like is connected to a physical USB device, but in reality is just logic pretending to be your USB device. There are tutorials for writing USB drivers for Linux. Or you create your own stub driver for the Device Control Manager (see picture above). This stub driver could run on Windows or Linux, it wouldn't matter. It could even run on the same Windows machine which is the USB client.

The DSF USB Loopback Device mentioned in the question itself, would be the same kind of solution as a stub driver for the Device Control Manager, but taking Linux out of the picture altogether.

风吹过旳痕迹 2024-08-22 11:03:59

You can write virtual USB device using QEMU.
You can duplicate already existing device, like the dev-serial.c found in this QEMU repository and change it for your needs.
After you write and compile your USB device you can simply attach it to your VM using the QEMU command line interface.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文