How to get USB device descriptor in user mode conveniently

I want to get the device descriptor of a USB device in user mode. And I read the usbview sample in WDK. It use the device IOCTL with IOCTL_USB_GET_NODE_CONNECTION_INFORMATION to the hub port to get the descriptor of the corresponding USB device. Is there another way to do this conveniently? I don’t want to get the hub information, and I’ve already get the SP_DEVINFO_DATA struct and the file handle of the device, can I use these to get the device descriptor?

What USBview shows you is the way you need to do it. Each usb enumerated driver does not expose usb details at its file io interface. If you have the SP_DEVINFO_DATA struct, use the devinst in the struct and call cm_get_parent to get the hub’s devinst and from there open a handle to the hub and send the ioctl.

d

debt from my phone

-----Original Message-----
From: disney_cheng@qq.com
Sent: Friday, June 24, 2011 6:46 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get USB device descriptor in user mode conveniently

I want to get the device descriptor of a USB device in user mode. And I read the usbview sample in WDK. It use the device IOCTL with IOCTL_USB_GET_NODE_CONNECTION_INFORMATION to the hub port to get the descriptor of the corresponding USB device. Is there another way to do this conveniently? I don’t want to get the hub information, and I’ve already get the SP_DEVINFO_DATA struct and the file handle of the device, can I use these to get the device descriptor?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Two ways to get the USB device descriptor: 1st is that you should be in
kernel, and has get the specified USB device’s pdo, and then send a
urb_get_device_descriptor request. 2nd, send ioctl to usbd driver in either
kernel or user mode.


Best regards!
Moore Zhang

2011/6/25 Doron Holan

> What USBview shows you is the way you need to do it. Each usb enumerated
> driver does not expose usb details at its file io interface. If you have the
> SP_DEVINFO_DATA struct, use the devinst in the struct and call cm_get_parent
> to get the hub’s devinst and from there open a handle to the hub and send
> the ioctl.
>
> d
>
> debt from my phone
>
> -----Original Message-----
> From: disney_cheng@qq.com
> Sent: Friday, June 24, 2011 6:46 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to get USB device descriptor in user mode conveniently
>
>
> I want to get the device descriptor of a USB device in user mode. And I
> read the usbview sample in WDK. It use the device IOCTL with
> IOCTL_USB_GET_NODE_CONNECTION_INFORMATION to the hub port to get the
> descriptor of the corresponding USB device. Is there another way to do this
> conveniently? I don’t want to get the hub information, and I’ve already get
> the SP_DEVINFO_DATA struct and the file handle of the device, can I use
> these to get the device descriptor?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


=================================
Best Regards!
Moore.Zhang (Zhang Pei)