From: galapogos on 10 May 2007 05:43 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!
From: Pietro Cerutti on 10 May 2007 05:55 galapogos wrote: > 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! > -- Pietro Cerutti PGP Public Key ID: http://gahr.ch/pgp
From: galapogos on 10 May 2007 06:10 On May 10, 5:55 pm, Pietro Cerutti <g...(a)gahr.ch> wrote: > galapogos wrote: > > 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! > > -- > Pietro Cerutti > > PGP Public Key ID:http://gahr.ch/pgp 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?
From: Uwe Sieber on 10 May 2007 06:27 galapogos wrote: > 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. Use an SetupDi enumeration for DISKs, you find your drive by its DeviceNumber. The USB device is the disk's parent device. I've shown this in a sample: http://www.codeproject.com/system/RemoveDriveByLetter.asp In the demo project there are some comment lines about the USB serial. Greetings from Germany Uwe
From: galapogos on 10 May 2007 10:09 On May 10, 6:27 pm, Uwe Sieber <m...(a)uwe-sieber.de> wrote: > galapogos wrote: > > 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. > > Use an SetupDi enumeration for DISKs, you find your drive by > its DeviceNumber. The USB device is the disk's parent device. > > I've shown this in a sample:http://www.codeproject.com/system/RemoveDriveByLetter.asp > > In the demo project there are some comment lines about > the USB serial. > > Greetings from Germany > > Uwe Hi Uwe, Thanks for the link. I'll try it out tomorrow, but I've taken a brief look at it. It seems to support volumes and disks. For my application, the drive will be a fixed disk in a USB enclosure, and it will be uninitialized/unpartitioned/unformatted. I'm accessing it RAW using ReadFile() and WriteFile(), so it will be accessed with "\\. \PhysicalDriveX" rather than "\\.\X:". Will that change anything? Or will it only eliminate the volume level(child of the disk)?
|
Next
|
Last
Pages: 1 2 3 Prev: Newbie question Next: How does Windows 2003 Server record shutdown reason? |