Emulating an existing USB device

Hi,

I want to emulate an existing USB HID controller device (i.e. I want to make a Domino look to a PC just like an example of the device - with the same VID, PID, and detailed protocol). This is not as crazy as it seems as after the USB comms are set up the device sends just a sequence of very simple fixed length packets for every movement. The problem then is setting up the USB comms in the first place.

I see the very helpful post here:

http://www.tinyclr.com/forum/search/?q=USBClientController&page=2

The main question, of course, is how to populate ‘hidGenericReportDescriptorPayload’. Now it occurs to me that (at least in theory) I can just temporarily plug the device I am trying to emulate into the Domino’s host port, read the descriptor and then I can copy the descriptor and use it in my client code.

At least in theory :slight_smile:

Any idea how I read the descriptor when it’s plugged into the host?

Regards,

Alan

Welcome,
A little deeper search would have got you the results you seek: but you were close… :wink:

http://www.tinyclr.com/forum/2/6680/
Cheers…

Ah yes, thanks, I see. I’m currently making progress with UsbView and SnoopyPro as we speak. I’ll post when I have some results.

Alan

Hi,

Hmmm, I’m finding right at the beginning that “new USBC_Device” uses some defaults (like bMaxPacketSize0=0x40) whereas I want to set it to 0x8 etc and also sets iManufacturer from a string somehow rather than hex (see below). Do I have to work through GHIElectronics.NETMF.USBClient or can I use Microsoft.SPOT.Hardware.UsbClient alone? Any way to set these values underneath the covers?

Alan

currently generated:

bLength            : 0x12 (18)
bDescriptorType    : 0x01 (1)
bcdUSB             : 0x0200 (512)
bDeviceClass       : 0x00 (0)
bDeviceSubClass    : 0x00 (0)
bDeviceProtocol    : 0x00 (0)

bMaxPacketSize0 : 0x40 (64)
idVendor : 0x046d (1133)
idProduct : 0xc628 (50728)
bcdDevice : 0x0414 (1044)
iManufacturer : 0x0a (10)
iProduct : 0x0b (11)
iSerialNumber : 0x0c (12)

bNumConfigurations : 0x01 (1)

required:

bLength            : 0x12 (18)
bDescriptorType    : 0x01 (1)
bcdUSB             : 0x0200 (512)
bDeviceClass       : 0x00 (0)
bDeviceSubClass    : 0x00 (0)
bDeviceProtocol    : 0x00 (0)

bMaxPacketSize0 : 0x08 (8)
idVendor : 0x046d (1133)
idProduct : 0xc628 (50728)
bcdDevice : 0x0414 (1044)
iManufacturer : 0x03 (3)
iProduct : 0x01 (1)
iSerialNumber : 0x00 (0)

bNumConfigurations : 0x01 (1)

Huh, I get the iManufacturer / iProduct / iSerialNumber strings now, but I see GHI seems to ignore mine (given to USBC_Device) and add yours for “GHI”, “FEZ” etc?

OK here’s the report…

Using the above two utilities I was able to sniff the device/endpoint/configuration/interface and report descriptors and add the values to my client code. (I had to find a pre-win7 machine to get Snoopy Pro to run to pick up the report descriptor). I was able to emulate the target HID peripheral 95% with the exception of the serial number (which my target has blank but FEZ only seems to allow “0”), the power usage and the device speed. Apparently not enough to fool the target’s windows client code but enough to get the USB to register OK, load the windows HID driver, and parse the report descriptor OK. So I’m getting closer - enough to enable me to pick up the communications with some utility code on the PC and start making progress with other parts of the project.

Alan