Scanning USB devices and reading USB descriptors

Discussion in 'C Programming' started by galapogos, May 10, 2007.

  1. galapogos

    galapogos Guest

    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!
     
    galapogos, May 10, 2007
    #1
    1. Advertisements

  2. 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/
     
    Pietro Cerutti, May 10, 2007
    #2
    1. Advertisements

  3. galapogos

    galapogos Guest

    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?
     
    galapogos, May 10, 2007
    #3
  4. 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.
     
    Pietro Cerutti, May 10, 2007
    #4
  5. IOW, ...

    (You know the drill)
     
    Kenny McCormack, May 11, 2007
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.