I just started looking into drivers recently, and I am not
quite getting the following:
1) I call CreateFile() with a name of my device and get a
VALID handle to the device.
2) I should be able to call DeviceIoControl () with this
handle and IOCTL_GET_USB_DESCRIPTOR as a parameter as
mentioned in Win98 DDK.
The problem is - what exactly is IOCTL_GET_USB_DESCRIPTOR?
In USBSCAN.H it is defined as
CTL_CODE(FILE_DEVICE_USB_SCAN,
IOCTL_INDEX+8,METHOD_BUFFERED,
FILE_ANY_ACCESS)
But I don't get what CTL_CODE is. Shouldn't
IOCTL_GET_USB_DESCRIPTOR be just a constant you supply to
DeviceIoControl () as dwIoControlCode?
Any help is appreciated...
If you look in <winioctl.h>, you'll see that CTL_CODE constructs a DWORD
from the four parameters.
--
Walter Oney
http://www.oneysoft.com
Yes, it's the second parameter to the DeviceIoControl call to the
driver.
Phat
Honeywell, Inc.
Software Engineer
N Petrov wrote:
> Hi, I am just curious how I can get device descriptor
> of a USB device from the user mode.
>
> I just started looking into drivers recently, and I am not
> quite getting the following:
>
> 1) I call CreateFile() with a name of my device and get a
> VALID handle to the device.
> 2) I should be able to call DeviceIoControl () with this
> handle and IOCTL_GET_USB_DESCRIPTOR as a parameter as
> mentioned in Win98 DDK.
>
> The problem is - what exactly is IOCTL_GET_USB_DESCRIPTOR?
> In USBSCAN.H it is defined as
> CTL_CODE(FILE_DEVICE_USB_SCAN,
> IOCTL_INDEX+8,METHOD_BUFFERED,
> FILE_ANY_ACCESS)
>
> But I don't get what CTL_CODE is. Shouldn't
> IOCTL_GET_USB_DESCRIPTOR be just a constant you supply to
> DeviceIoControl () as dwIoControlCode?
>
> Any help is appreciated...
Guys thanks a lot. The problem was - I tried to use VB. Right now
I realized it's much better to write and debug everything in VC.
What I also didn't realize was that I had to handle the same "IO"
flag that I used in DeviceIoControl () in the APP in my driver's
IOCTL... I guess that's just some of those "assumptions" that you
make when you just start doing something...