Author Topic: Reading in USB_DEVICE_DESCRIPTOR data in WinUSB_CS  (Read 10925 times)

goodnewsjim

  • Frequent Contributor
  • ****
  • Posts: 52
Reading in USB_DEVICE_DESCRIPTOR data in WinUSB_CS
« on: March 16, 2015, 02:03:44 pm »
Hello I'm just getting back into my old project, and could use a tad bit of help.

IN WINUSB Demo firmware, there is a file called:usb_descriptors.c

In it is a struct:
ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
    0x12,                   // Size of this descriptor in bytes
    USB_DESCRIPTOR_DEVICE,  // DEVICE descriptor type
    0x0200,                 // USB Spec Release Number in BCD format       
    0x00,                   // Class Code
    0x00,                   // Subclass code
    0x00,                   // Protocol code
    USB_EP0_BUFF_SIZE,      // Max packet size for EP0, see usb_config.h
    0x04D8,                 // Vendor ID: 0x04D8 is Microchip's Vendor ID
    0x0053,                 // Product ID: 0x0053
    0x0000,                 // Device release number in BCD format
    0x01,                   // Manufacturer string index
    0x02,                   // Product string index
    0x03,                   // Device serial number string index
    0x01                    // Number of possible configurations
};

Now in WinUSB_CS the windows side client, I want to be able to read:
*Manufacturer string index
*Product string index
*Device serial number string index

I can get PID/VID from: devicePathName in DeviceManagement.cs, but I'm not sure where to get those three pieces of data I'm interested in

Hopefully this is an easy question to the right person.  I'm just getting back into development though, so I'm very slow on the uptake until I can get into a groove of some kind.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research

goodnewsjim

  • Frequent Contributor
  • ****
  • Posts: 52
Re: Reading in USB_DEVICE_DESCRIPTOR data in WinUSB_CS
« Reply #2 on: March 16, 2015, 11:14:50 pm »
Thanks a ton Jan.

I'm trying to not be so forum-needy, but its been so long since I've done this.

If I have one product ID, but different serial numbers and product strings, I should be able to identify different devices even if they all share the same VID/PID.  I'm almost certainly sure this is the case, but just making sure before I go ahead.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Reading in USB_DEVICE_DESCRIPTOR data in WinUSB_CS
« Reply #3 on: March 17, 2015, 09:18:08 am »
Yes, the WinUSB API has functions to get this information.

Don't worry about asking questions; that's what the forum is here for!

goodnewsjim

  • Frequent Contributor
  • ****
  • Posts: 52
Re: Reading in USB_DEVICE_DESCRIPTOR data in WinUSB_CS
« Reply #4 on: March 17, 2015, 03:41:52 pm »
Thank you again Jan!