Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting DeviceDescriptor

91 views
Skip to first unread message

N Petrov

unread,
Jan 27, 1999, 3:00:00 AM1/27/99
to
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...

Walter Oney

unread,
Jan 27, 1999, 3:00:00 AM1/27/99
to
N Petrov wrote:
> 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?

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

Phat To

unread,
Jan 27, 1999, 3:00:00 AM1/27/99
to

Shouldn't IOCTL_GET_USB_DESCRIPTOR be just a constant you supply to
DeviceIoControl () as dwIoControlCode?

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...


N Petrov

unread,
Jan 29, 1999, 3:00:00 AM1/29/99
to
> If you look in <winioctl.h>, you'll see that CTL_CODE constructs a DWORD
> from the four parameters.

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...

0 new messages