USB Device_Descriptor

K

koushi007

Hi

I am trying to get the device descriptor of a storage device in order
to extract the vendor ID and Product ID. In the actual program the
handle for the device is obtained through another module which gets
the handle for the user specified mass storage device.



I had tried to get USB_DEVICE_DESCRIPTOR, DEVICE_DESCRIPTOR using
IOCTL_GET_USB_DESCRIPTOR and ICOTL_GET_DEVICE_DESCRIPTOR. however both
the Device IO functions exit with the error "The request is not
supported".



Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?



Thanks and Regards

Sundaram



PS: The portion of the code I have attached



//DEVICE_DESCRIPTOR

bResult = DeviceIoControl(hDevice,

IOCTL_GET_DEVICE_DESCRIPTOR,

DevDescriptor, sizeof(*DevDescriptor),

DevDescriptor, sizeof(*DevDescriptor),

&lpBytesReturned,

(LPOVERLAPPED) NULL);

CloseHandle(hDevice);



//USB_DEVICE_DESCRIPTOR

ScanDesc.DescriptorType = USB_STRING_DESCRIPTOR_TYPE;

ScanDesc.Index = 4;

ScanDesc.LanguageId = 0;

DevDescriptor->bDescriptorType = USB_STRING_DESCRIPTOR_TYPE;



bResult = DeviceIoControl(hDevice,

IOCTL_GET_USB_DESCRIPTOR,

&ScanDesc, sizeof(ScanDesc),

DevDescriptor, sizeof(*DevDescriptor),

&lpBytesReturned,

(LPOVERLAPPED) NULL);
 
V

Victor Bazarov

[..]
Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?
[..]

Yes, someone in the newsgroup dedicated to your OS programming can.

V
 
R

red floyd

[..]
Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?
[..]
Yes, someone in the newsgroup dedicated to your OS programming can.
I just need to know is there a way to read the product id and vendor
id.! Not the code snippet!!

Hints:

1. If the answer to your question is pretty much the same, regardless
of the language you use (i.e. Delphi, C++, VB) ... it's OT in
comp.lang.c++. Ask in a newsgroup dedicated to your platform, or in
comp.programming.*.

2. If the answer to your question would not make sense on a different
platform (i.e. Windows vs. Linux), ... it's OT in comp.lang.c++. Ask in
a newsgroup dedicated to your platform.

Your question fails both tests. Try a Windows newsgroup or a Linux
newsgroup.
 
K

Kai-Uwe Bux

[..]
Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?
[..]

Yes, someone in the newsgroup dedicated to your OS programming can.

V

I just need to know is there a way to read the product id and vendor
id.! Not the code snippet!!

The answer to your question topical in this group would be: standard C++ has
no built-in means of dealing with USB devices. You will need to use a
non-standard library, which is off-topic in this group.

That is why Victor directed you to a news group where the topical answer
would, for instance, include a hint as to which library might be suitable
and where you could find it.


Best

Kai-Uwe Bux
 
K

koushi007

(e-mail address removed) wrote:
[..]
Can some one please help me out in getting the Vendor ID and Product
ID of a storage device?
[..]
Yes, someone in the newsgroup dedicated to your OS programming can.
V
I just need to know is there a way to read the product id and vendor
id.! Not the code snippet!!

The answer to your question topical in this group would be: standard C++ has
no built-in means of dealing with USB devices. You will need to use a
non-standard library, which is off-topic in this group.

That is why Victor directed you to a news group where the topical answer
would, for instance, include a hint as to which library might be suitable
and where you could find it.

Best

Kai-Uwe Bux- Hide quoted text -

- Show quoted text -

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top