How can i get USBD_INTERFACE_INFORMATION if i want to control the second interface

Pls…help…
I have a composite USB device consists of a mouse interface and a
transmission interface .
There are two driver supported.One is MOUCLASS of Microsoft, and i should
create
theother driver for the second interface.

During initialization
I don’t know how to get USBD_INTERFACE_INFORMATION structure of the
transmission
interface.
When i trying to get urb->UrbSelectConfiguration.Interface by calling
urb=USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);
after ConfigurationDescriptor be retrived.The urb was returned as NULL.

I think maybe USBD_CreateConfigurationRequest(…) should not be call, cause
MOUCLASS
driver had selected the proper configuration descriptor?
But I still need USBD_INTERFACE_INFORMATION that is returned by
USBD_CreateConfigurationRequest(…) to do some transmission works,Because
there are pipe
handle informations in.

Should i set proper ConfigurationDescriptor a agin in my driver, like there
is no other driver?
Can i get USBD_INTERFACE_INFORMATION with out
USBD_CreateConfigurationRequest(…)?

How can i initializ the second interface of a composite USB device?

v

Mouclass (actually HIDCLASS b/c mouclass doesn’t know anything about
usb) claims the HID part, but since you are a composite device, the usb
generic parent splits your device into 2 separate PDOs and HID doesn’t
see your 2nd interface.

The code you describe should work, but please confirm that your driver
is actually installed on the 2nd PDO and is not root enumerated. To do
this, you can break in during your AddDevice routine and run !devstack
in windbg. If the instance path is USB\Xxx\Xxx then you are
installed properly.

If you are are installed properly, post the code you are trying to use
to configure your device.

Thx
d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of polybear
Sent: Wednesday, September 01, 2004 7:11 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How can i get USBD_INTERFACE_INFORMATION if i want to
control the second interface

Pls…help…
I have a composite USB device consists of a mouse interface and a
transmission interface .
There are two driver supported.One is MOUCLASS of Microsoft, and i
should
create
theother driver for the second interface.

During initialization
I don’t know how to get USBD_INTERFACE_INFORMATION structure of the
transmission
interface.
When i trying to get urb->UrbSelectConfiguration.Interface by calling
urb=USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);
after ConfigurationDescriptor be retrived.The urb was returned as NULL.

I think maybe USBD_CreateConfigurationRequest(…) should not be call,
cause
MOUCLASS
driver had selected the proper configuration descriptor?
But I still need USBD_INTERFACE_INFORMATION that is returned by
USBD_CreateConfigurationRequest(…) to do some transmission
works,Because
there are pipe
handle informations in.

Should i set proper ConfigurationDescriptor a agin in my driver, like
there
is no other driver?
Can i get USBD_INTERFACE_INFORMATION with out
USBD_CreateConfigurationRequest(…)?

How can i initializ the second interface of a composite USB device?

v


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Dear Doron Holan…

Sorry i don’t have windbg, but the root obj “Composite USB device” , “Hid
input device”
had been installed as shown within device manager. And last interface keeps
in “can’t load
the driver of this device”.

Configuration descriptor is differcence between device ceclare and driver
retrive!?
wTotalLength 0x19 ===>should be 0x32 ?
bNumInterfaces 0x01===>should be 0x02?

relative data as below.
Device ==retrive by CATC)=============================================
Device descriptor
12 01 10 01 00 00 00 08
6A 0E 37 2F 00 01 00 00
00 01

Configuration descriptor
09 02 32 00 02 01 00 A0
32 09 04 00 00 01 03 01
02 00 09 21 00 01 00 01
22 34 00 07 05 81 03 04
00 0A 09 04 01 00 01 FF
FF FF 00 07 05 03 03 08
00 A0

Drvier===============================================================
Device Descriptor
bLength 18
bDescriptorType 0x01
bcdUSB 0X110
bDeviceClass 0x00
bDeviceSubClass 0x00
bDeviceProtocal 0x00
bMaxPacketSize 0x08
idVendor 0x0e6a
idProduct 0x2f37
bcdDevice 0x100
iManufacturer 0x00
iproduct 0x00
iSerialNumber 0x00
bNumConfigurations 0x01
Configuration Descriptor
bLength 9
bdescriptorType 0x02
wTotalLength 0x19
bNumInterfaces 0x01
iConfiguration 0x0
bmAttributes 0xa0
MaxPower 32

Code ===(from Bulkusb)======================================================

NTSTATUS
BulkUsb_ConfigureDevice(
IN PDEVICE_OBJECT DeviceObject
)
{
PDEVICE_EXTENSION deviceExtension;
NTSTATUS ntStatus;
PURB urb;
ULONG siz;

BULKUSB_KdPrint( DBGLVL_HIGH,(“enter BulkUsb_ConfigureDevice\n”));

deviceExtension = DeviceObject->DeviceExtension;

BULKUSB_ASSERT( deviceExtension->UsbConfigurationDescriptor == NULL );

urb = BULKUSB_ExAllocatePool(NonPagedPool,
sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));
if ( !urb )
return STATUS_INSUFFICIENT_RESOURCES;

siz = sizeof(USB_CONFIGURATION_DESCRIPTOR) + 512;
while( 1 ) {

deviceExtension->UsbConfigurationDescriptor =
BULKUSB_ExAllocatePool(NonPagedPool, siz);

if ( !deviceExtension->UsbConfigurationDescriptor ) {
BULKUSB_ExFreePool(urb);
return STATUS_INSUFFICIENT_RESOURCES;
}

UsbBuildGetDescriptorRequest(urb,
(USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
USB_CONFIGURATION_DESCRIPTOR_TYPE,
0,
0,
deviceExtension->UsbConfigurationDescriptor,
NULL,
siz,
NULL);

ntStatus = BulkUsb_CallUSBD(DeviceObject, urb);

BULKUSB_KdPrint( DBGLVL_HIGH,(“BulkUsb_CallUSBD() Configuration
Descriptor = %x, len %x\n”,
deviceExtension->UsbConfigurationDescriptor,
urb->UrbControlDescriptorRequest.TransferBufferLength));

BULKUSB_KdPrint( DBGLVL_HIGH,(“bLength
%x\n”,deviceExtension->UsbConfigurationDescriptor->bLength));
BULKUSB_KdPrint( DBGLVL_HIGH,(“bDescriptorType
%x\n”,deviceExtension->UsbConfigurationDescriptor->bDescriptorType));
BULKUSB_KdPrint( DBGLVL_HIGH,(“wTotalLength
%x\n”,deviceExtension->UsbConfigurationDescriptor->wTotalLength ));
BULKUSB_KdPrint( DBGLVL_HIGH,(“bNumInterfaces
%x\n”,deviceExtension->UsbConfigurationDescriptor->bNumInterfaces));
BULKUSB_KdPrint( DBGLVL_HIGH,(“iConfiguration
%x\n”,deviceExtension->UsbConfigurationDescriptor->iConfiguration ));
BULKUSB_KdPrint( DBGLVL_HIGH,(“bmAttributes
%x\n”,deviceExtension->UsbConfigurationDescriptor->bmAttributes ));
BULKUSB_KdPrint( DBGLVL_HIGH,(“MaxPower
%x\n”,deviceExtension->UsbConfigurationDescriptor->MaxPower ));

if (urb->UrbControlDescriptorRequest.TransferBufferLength>0 &&
deviceExtension->UsbConfigurationDescriptor->wTotalLength > siz) {

siz = deviceExtension->UsbConfigurationDescriptor->wTotalLength;
BULKUSB_ExFreePool(deviceExtension->UsbConfigurationDescriptor);
deviceExtension->UsbConfigurationDescriptor = NULL;
} else {
break; // we got it on the first try
}

} // end, while (retry loop )

BULKUSB_ExFreePool(urb);
BULKUSB_ASSERT( deviceExtension->UsbConfigurationDescriptor );

ntStatus = BulkUsb_SelectInterface(DeviceObject,
deviceExtension->UsbConfigurationDescriptor);

BULKUSB_KdPrint( DBGLVL_HIGH,(“exit BulkUsb_ConfigureDevice (%x)\n”,
ntStatus));

return ntStatus;
}

NTSTATUS
BulkUsb_SelectInterface(
IN PDEVICE_OBJECT DeviceObject,
IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor
)
{
PDEVICE_EXTENSION deviceExtension;
NTSTATUS ntStatus=STATUS_SUCCESS;
PURB urb = NULL;
ULONG i;
PUSB_INTERFACE_DESCRIPTOR interfaceDescriptor = NULL;
PUSBD_INTERFACE_INFORMATION Interface = NULL;
USHORT siz;
PUCHAR pInf;

BULKUSB_KdPrint( DBGLVL_MEDIUM,(“enter BulkUsb_SelectInterface\n”));

deviceExtension = DeviceObject->DeviceExtension;

BULKUSB_KdPrint( DBGLVL_HIGH,(“BulkUsb_SelectInterface() called with
NULL Interface\n”));

//**************************
// Here !!! urb ==NULL
//**************************

urb = USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);

if (urb) {
}else{

}

… other code…

I found some information on MS web site:
Maybe that is why i can't get my urb..

Note the following points:

If you are developing a composite device, you need to use
USBD_CreateConfigurationRequestEx() in your vendor-specific USB storage
driver. The function USBD_CreateConfigurationRequest() works correctly only
for the first interface of a multiple-interface device. This issue has been
addressed in the latest sample driver in the KB article Q257751.

============================================

"polybear" ¦b¶l¥ó news:xxxxx@ntdev ¤¤¼¶¼g...
> Dear Doron Holan..
>
> Sorry i don't have windbg, but the root obj "Composite USB device" , "Hid
> input device"
> had been installed as shown within device manager. And last interface
keeps
> in "can't load
> the driver of this device".
>
> Configuration descriptor is differcence between device ceclare and driver
> retrive!?
> wTotalLength 0x19 ===>should be 0x32 ?
> bNumInterfaces 0x01===>should be 0x02?
>
> relative data as below.
> Device ==retrive by CATC)=============================================
> Device descriptor
> 12 01 10 01 00 00 00 08
> 6A 0E 37 2F 00 01 00 00
> 00 01
>
> Configuration descriptor
> 09 02 32 00 02 01 00 A0
> 32 09 04 00 00 01 03 01
> 02 00 09 21 00 01 00 01
> 22 34 00 07 05 81 03 04
> 00 0A 09 04 01 00 01 FF
> FF FF 00 07 05 03 03 08
> 00 A0
>
> Drvier===============================================================
> Device Descriptor
> bLength 18
> bDescriptorType 0x01
> bcdUSB 0X110
> bDeviceClass 0x00
> bDeviceSubClass 0x00
> bDeviceProtocal 0x00
> bMaxPacketSize 0x08
> idVendor 0x0e6a
> idProduct 0x2f37
> bcdDevice 0x100
> iManufacturer 0x00
> iproduct 0x00
> iSerialNumber 0x00
> bNumConfigurations 0x01
> Configuration Descriptor
> bLength 9
> bdescriptorType 0x02
> wTotalLength 0x19
> bNumInterfaces 0x01
> iConfiguration 0x0
> bmAttributes 0xa0
> MaxPower 32
>
> Code ===(from
Bulkusb)======================================================
>
> NTSTATUS
> BulkUsb_ConfigureDevice(
> IN PDEVICE_OBJECT DeviceObject
> )
> {
> PDEVICE_EXTENSION deviceExtension;
> NTSTATUS ntStatus;
> PURB urb;
> ULONG siz;
>
>
> BULKUSB_KdPrint( DBGLVL_HIGH,("enter BulkUsb_ConfigureDevice\n"));
>
> deviceExtension = DeviceObject->DeviceExtension;
>
> BULKUSB_ASSERT( deviceExtension->UsbConfigurationDescriptor == NULL );
>
> urb = BULKUSB_ExAllocatePool(NonPagedPool,
> sizeof(struct _URB_CONTROL_DESCRIPTOR_REQUEST));
> if ( !urb )
> return STATUS_INSUFFICIENT_RESOURCES;
>
> siz = sizeof(USB_CONFIGURATION_DESCRIPTOR) + 512;
> while( 1 ) {
>
> deviceExtension->UsbConfigurationDescriptor =
> BULKUSB_ExAllocatePool(NonPagedPool, siz);
>
> if ( !deviceExtension->UsbConfigurationDescriptor ) {
> BULKUSB_ExFreePool(urb);
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> UsbBuildGetDescriptorRequest(urb,
> (USHORT) sizeof (struct _URB_CONTROL_DESCRIPTOR_REQUEST),
> USB_CONFIGURATION_DESCRIPTOR_TYPE,
> 0,
> 0,
> deviceExtension->UsbConfigurationDescriptor,
> NULL,
> siz,
> NULL);
>
> ntStatus = BulkUsb_CallUSBD(DeviceObject, urb);
>
> BULKUSB_KdPrint( DBGLVL_HIGH,("BulkUsb_CallUSBD() Configuration
> Descriptor = %x, len %x\n",
> deviceExtension->UsbConfigurationDescriptor,
> urb->UrbControlDescriptorRequest.TransferBufferLength));
>
> BULKUSB_KdPrint( DBGLVL_HIGH,("bLength
> %x\n",deviceExtension->UsbConfigurationDescriptor->bLength));
> BULKUSB_KdPrint( DBGLVL_HIGH,("bDescriptorType
> %x\n",deviceExtension->UsbConfigurationDescriptor->bDescriptorType));
> BULKUSB_KdPrint( DBGLVL_HIGH,("wTotalLength
> %x\n",deviceExtension->UsbConfigurationDescriptor->wTotalLength ));
> BULKUSB_KdPrint( DBGLVL_HIGH,("bNumInterfaces
> %x\n",deviceExtension->UsbConfigurationDescriptor->bNumInterfaces));
> BULKUSB_KdPrint( DBGLVL_HIGH,("iConfiguration
> %x\n",deviceExtension->UsbConfigurationDescriptor->iConfiguration ));
> BULKUSB_KdPrint( DBGLVL_HIGH,("bmAttributes
> %x\n",deviceExtension->UsbConfigurationDescriptor->bmAttributes ));
> BULKUSB_KdPrint( DBGLVL_HIGH,("MaxPower
> %x\n",deviceExtension->UsbConfigurationDescriptor->MaxPower ));
>
> if (urb->UrbControlDescriptorRequest.TransferBufferLength>0 &&
> deviceExtension->UsbConfigurationDescriptor->wTotalLength > siz) {
>
> siz = deviceExtension->UsbConfigurationDescriptor->wTotalLength;
> BULKUSB_ExFreePool(deviceExtension->UsbConfigurationDescriptor);
> deviceExtension->UsbConfigurationDescriptor = NULL;
> } else {
> break; // we got it on the first try
> }
>
> } // end, while (retry loop )
>
> BULKUSB_ExFreePool(urb);
> BULKUSB_ASSERT( deviceExtension->UsbConfigurationDescriptor );
>
> ntStatus = BulkUsb_SelectInterface(DeviceObject,
> deviceExtension->UsbConfigurationDescriptor);
>
> BULKUSB_KdPrint( DBGLVL_HIGH,("exit BulkUsb_ConfigureDevice (%x)\n",
> ntStatus));
>
> return ntStatus;
> }
>
>
> NTSTATUS
> BulkUsb_SelectInterface(
> IN PDEVICE_OBJECT DeviceObject,
> IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor
> )
> {
> PDEVICE_EXTENSION deviceExtension;
> NTSTATUS ntStatus=STATUS_SUCCESS;
> PURB urb = NULL;
> ULONG i;
> PUSB_INTERFACE_DESCRIPTOR interfaceDescriptor = NULL;
> PUSBD_INTERFACE_INFORMATION Interface = NULL;
> USHORT siz;
> PUCHAR pInf;
>
> BULKUSB_KdPrint( DBGLVL_MEDIUM,("enter BulkUsb_SelectInterface\n"));
>
> deviceExtension = DeviceObject->DeviceExtension;
>
>
> BULKUSB_KdPrint( DBGLVL_HIGH,("BulkUsb_SelectInterface() called with
> NULL Interface\n"));
>
> //
> // Here !!!! urb ==NULL
> //

>
> urb = USBD_CreateConfigurationRequest(ConfigurationDescriptor, &siz);
>
> if (urb) {
> }else{
>
> }
>
> ... other code...
>
>
>