Scanning USB devices and reading USB descriptors

G

galapogos

Hi,

I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.

Thanks!
 
P

Pietro Cerutti

galapogos said:
Hi, Hi,


I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.

While this is not possible in plain standard C, there are certainly a
few libraries that you can use to access USB devices.
One of those is libusb [1], which is available on quite a few Unix-like
operating system.

[1] http://libusb.sourceforge.net/
 
G

galapogos

galapogos said:
Hi,
Hi,



I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.

While this is not possible in plain standard C, there are certainly a
few libraries that you can use to access USB devices.
One of those is libusb [1], which is available on quite a few Unix-like
operating system.

[1]http://libusb.sourceforge.net/



Thanks. I actually have libusb-win32. I wasn't aware the source code
was included. I'll check it out.

I also checked out MSDN, specifically the "USB Structures and
Enumerations", and several of the functions all depend on usbdlib.h,
but despite copying the file over to my project from libusb I can't
seem to use the functions. How exactly do I use the libusb source
files?
 
P

Pietro Cerutti

galapogos said:
galapogos said:
Hi, Hi,



I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.
While this is not possible in plain standard C, there are certainly a
few libraries that you can use to access USB devices.
One of those is libusb [1], which is available on quite a few Unix-like
operating system.

[1]http://libusb.sourceforge.net/



Thanks. I actually have libusb-win32. I wasn't aware the source code
was included. I'll check it out.

I also checked out MSDN, specifically the "USB Structures and
Enumerations", and several of the functions all depend on usbdlib.h,
but despite copying the file over to my project from libusb I can't
seem to use the functions. How exactly do I use the libusb source
files?

No clue. You better ask to a more specific newsgroup, since your issue
isn't related to the C programming language, but rather to the way you
access some third-party library function.

Please check the libusb website, they surely have documentation on their
product.
 

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

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top