Ekansh Gupta
Ekansh Gupta

Reputation: 417

Creating custom virtual usb device using usb-vhci

I am new to working on virtual USB device simulation in Linux. So far I have installed the virtual host control (vhci) libraries as per this tutorial (http://sourceforge.net/p/usb-vhci/wiki/Home/) and can see a virtual USB device being created which has some typical specifications that the library implements (Bus 05 in the image with the vendor and product IDs being "dead" and "beef" respectively).

USB Devices list

However I want the created virtual device to have the specifications of a real device I have at hand (a mouse, for example).

So how to enumerate and initialize a virtual USB device with the same credentials as another device?

Upvotes: 2

Views: 3680

Answers (1)

ttyridal
ttyridal

Reputation: 468

The kernel module (vhci-hcd) is only a (virtual) host controller that you can attach virtual devices to.

If you want to emulate eg a mouse you should get the libusb_vhci from the same source, and look into the examples. These are bare minimum starting points that does nothing except for the basic usb device handling. You'll have to extend this with all descriptors and protocol handling for a USB HID mouse or whatever you want to emulate.

http://www.usbmadesimple.co.uk/ums_5.htm should be a good starting point.

you can use lsusb and in particular lsusb -D to dump the descriptors of devices you have connected.

Upvotes: 2

Related Questions