Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulate a USB Device for Automation

I have to simulate a USB Device for automation and testing purposes (in Linux). Original driver/application for this device uses “libusb” to communicate with it.

I don’t have much experience in Linux and Simulation, after some searching I have understood that I need to write a kernel level driver and an application in user-space to simulate that device. Is this right? If Yes, How can this be done?

Thanks in Advance.

like image 621
Gaurav Agrawal Avatar asked Jun 03 '12 18:06

Gaurav Agrawal


People also ask

What is virtual USB device?

USB virtualization (AKA a virtual USB) is when a physical USB device can be accessed and managed by another remote computer. This remote computer, and the computer physically connected to the USB, share the same network.

Can a virtual machine use USB?

You can use external USB hard drives with your virtual machine, much like any other USB device.

What is a USB device tree?

USB Device Tree Viewer or UsbTreeView is based upon the Microsoft "USBView" sample application found in the Windows Driver Development Kits. This utility quickly displays all the USB hubs and ports, beginning with connections status, device information, and pertinent connection information.


1 Answers

Finally implemented it by modifying "libusb", modified it to send and receive usb transfers from message queue instead of usbfs. Programmed my simulator to create libsub type transfers and send/receive them using message queues as well.

Simulator now interprets the incoming transfers and sends it to a command parser, which sends request/message to automation system using sockets in a specific format. Automation system sends it's instruction by sending to command parser using socket. This socket invokes method specific to each request in simulator, Now simulator forms an appropriate transfer structure and passes to device plugin (via libusb) through message queue.

like image 127
Gaurav Agrawal Avatar answered Sep 29 '22 16:09

Gaurav Agrawal