Hi,
I am currently writing a usb drivers and below is the description in
details.
Project: Driver for USB to Serial device in WinCE
IDE: Platform Builder for Win CE 5.0
So far, we are able to get the device to enumerate properly (Getting
device, configuration descriptors etc..) However, we are unable to set
the configuration. In the Device descriptor, there are 2
Configurations. Config1 with only 1 bulk out pipe. Config2 one with 1
bulk out, 1 bulk in and 1 interrupt. The problem we are having is
setting the configuration to Config2.
Descriptors:
// Device Descriptor
- pDevice 0x005114dc
dwCount 0x00000020
- Descriptor {...}
bLength 0x12 '?'
bDescriptorType 0x01 '?'
bcdUSB 0x0110
bDeviceClass 0xff '=FF'
bDeviceSubClass 0x00
bDeviceProtocol 0x00
bMaxPacketSize0 0x08 '?'
idVendor 0x0451
idProduct 0x3410
bcdDevice 0x0101
iManufacturer 0x01 '?'
iProduct 0x02 '?'
iSerialNumber 0x03 '?'
bNumConfigurations 0x02 '?'
//Config1
- lpActiveConfig 0x002bc1e0
dwCount 0x0000001c
- Descriptor {...}
bLength 0x09 '?'
bDescriptorType 0x02 '?'
wTotalLength 0x0019
bNumInterfaces 0x01 '?'
bConfigurationValue 0x01 '?'
iConfiguration 0x00
bmAttributes 0x80 '=80'
MaxPower 0x32 '2'
lpvExtended 0x00000000
dwNumInterfaces 0x00000001
+ lpInterfaces 0x005113e0
//Config2
- pConfigDesc 0x002bc1fc
dwCount 0x0000001c
- Descriptor {...}
bLength 0x09 '?'
bDescriptorType 0x02 '?'
wTotalLength 0x0027
bNumInterfaces 0x01 '?'
bConfigurationValue 0x02 '?'
iConfiguration 0x00
bmAttributes 0xa0 ' '
MaxPower 0x32 '2'
lpvExtended 0x00000000
dwNumInterfaces 0x00000001
+ lpInterfaces 0x00511440
This is what we used to set the Configuration:
// This SET configuration was completed successfully
USB_DEVICE_REQUEST usbDevReq;
usbDevReq.bmRequestType =3D USB_REQUEST_HOST_TO_DEVICE |
USB_REQUEST_STANDARD | USB_REQUEST_FOR_DEVICE;
usbDevReq.bRequest =3D USB_REQUEST_SET_CONFIGURATION;
usbDevReq.wValue =3D (pDevice->lpConfigs +
*ConfigIndex)->Descriptor.bConfigurationValue;
usbDevReq.wIndex =3D 0;
usbDevReq.wLength =3D 0;
USB_TRANSFER usbTrans =3D UsbFuncs->lpIssueVendorTransfer(hUsbDevice,
NULL,
0, USB_OUT_TRANSFER | USB_SHORT_TRANSFER_OK,
&usbDevReq, NULL, NULL);
// This GET configuration was able to verify that the Configuration was
Set to Config2 (ConfigValue =3D 2)
int Configvalue =3D 0;
usbDevReq.bmRequestType =3D 0x80;
usbDevReq.bRequest =3D USB_REQUEST_GET_CONFIGURATION;
usbDevReq.wValue =3D 0;
usbDevReq.wIndex =3D 0;
usbDevReq.wLength =3D 1;
usbTrans =3D UsbFuncs->lpIssueVendorTransfer(hUsbDevice, NULL, 0,
USB_IN_TRANSFER | USB_SHORT_TRANSFER_OK,
&usbDevReq, &Configvalue, NULL);
// However, Using lpGetDeviceInfo, the
lpActiveConfig->Descriptor->bConfigurationValue is still 1(Config1)
pDevice =3D UsbFuncs->lpGetDeviceInfo( hUsbDevice );
Another indication that the lpActiveConfig has not been set properly is
that we are unable to open the bulk in pipe which is only present in
Config2.
Anyone can give hints? Please advise.
Thanks.