Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to emulate USB devices?

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.

like image 458
Jader Dias Avatar asked Dec 16 '09 11:12

Jader Dias


People also ask

What is USB emulation?

Architecture: USB Device Emulation (UDE) The section describes architecture of USB Device Emulation(UDE) that emulates the behavior of a USB host controller and a connected device. By using UDE, a non-USB hardware can communicate with the upper layers by using the USB host-side drivers in Windows.

What is USB emulation in BIOS?

This BIOS feature determines if the USB flash drive should be treated as a floppy disk drive or a hard drive. Of course, it only comes into effect if you have a USB flash drive plugged into your computer's USB port when it boots up.

What is UDE client?

UDE objects and handlesThe client driver requests the creation of the objects and lifetime of the object is managed by the class extension. Emulated host controller object (WDFDEVICE) Represents the emulated host controller and is the main handle between the UDE class extension and the client driver.


1 Answers

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.

like image 125
Prof. Falken Avatar answered Sep 22 '22 01:09

Prof. Falken