Page 1 of 1

Error while "Select Configuration"

Posted: Fri Sep 25, 2009 10:32 pm
by Kai.n
Hey!

I've got the next problem.
What we wanted to do works now - thanks christian, you helped us a lot ;)

we're now trying to get our device working with other os but under windows vista / seven the device doesn't even initialize correct.

during the inits, the descriptors are exchanged between host and device, after that the configuration should get selected - but it allways fail with an error code 0x80000300 (invalid parameter).

here's a log from a debugging tool:

Code: Select all

000026: Control Transfer (UP), 25.09.2009 22:07:20.728 +0.005. Status: 0x00000000
Pipe Handle: 0x2ba3060

 09 02 54 00 03 01 00 80 32 08 0B 00 02 02 02 01   ..T....€2.......
 00 09 04 00 00 01 02 02 01 00 05 24 00 10 01 04   ...........$....
 24 02 02 05 24 06 00 01 05 24 01 03 01 07 05 83   $...$....$.....ƒ
 03 08 00 FF 09 04 01 00 02 0A 00 00 00 07 05 01   ...ÿ............
 02 08 00 00 07 05 81 02 08 00 00 09 04 02 00 00   ...............
 00 00 00 00                                       ....
Setup Packet
000027: Select Configuration (DOWN), 25.09.2009 22:07:20.728 +0.0
Configuration Index: 1

000029: Select Configuration (UP), 25.09.2009 22:07:21.463 +0.0. Status: 0x80000300
Configuration Index: 1
Configuration Handle: 0x0

000030: PnP Event: Device Disconnected (UP), 25.09.2009 22:07:23.022 +1.559
The USB device has just been removed from the system, all drivers unloaded.



The descriptors are correct - i checked them manually. On XP x64 and xp x32 it's ok - Status 0x00000000 and the configuration handle is something else.
it works inside a vmware on every system.

does someone knows anything about that?
would be beautifull when the device would work on other systems than an XP 32 bit ;)

Thanks,
kai

Re: Error while "Select Configuration"

Posted: Sun Oct 04, 2009 11:55 am
by christian
Did you try to run V-USB in debug mode and connect a terminal to the serial debug output (19200 bps)? This way you can check whether the same data arrives at V-USB which was sent by the OS and vice versa. If there is a discrepancy, something is broken in the low level stuff (e.g. data loss due to interrupt latency, a hardware issue or a bug in V-USB). Otherwise it may be an issue with descriptor contents.

Re: Error while "Select Configuration"

Posted: Thu Oct 08, 2009 1:59 am
by Kai.n
hey!

thanks for your answer ;)
i have nearly given up, but we'll hopefully get it working :)

nope, i didn't, i'll try that out, but i checked the pc-log against the descriptor contents in the sourcecode, it looked fine...
but I'll check that.

interrupt latency...no idea, but as it works on xp, why shouldn't it under vista/seven?
has microsoft lowered support for low-speed devices in the new os's?

what's strange to me is that i can run the device (at least some parts) on a Seven inside a VM on a Seven host while it doesn't work on the host.
Any idea why that's possible?

as we only have modified an existing device, i post you the changed descriptor parts...maybe you can find anything :)

Code: Select all


[config Descriptor]
    /* IAD descriptor */
/* to merge the 2 CDC-Devices together as it's a composite device */
    8,
    11,       // bDescriptorType = 11
       0x00,               // bFirstInterface
       0x02,               // bInterfaceCount
       0x02,               // bFunctionClass (Communication Class)
       0x02,               // bFunctionSubClass (Abstract Control Model)
       0x01,               // bFunctionProcotol (V.25ter, Common AT commands)
       0x00,                // iInterface

[CDC - Interface Descriptor with one Endpoint]
[CDC Data Interface Descriptor with 2 Endpoints]

[Another costum-device interface descriptor ]

here's the complete config descriptor...

Code: Select all

static PROGMEM char configDescrCDC[] = {   /* USB configuration descriptor */
    9,          /* sizeof(usbDescrConfig): length of descriptor in bytes */
    USBDESCR_CONFIG,    /* descriptor type */
    84,
    0,          /* total length of data returned (including inlined descriptors) */
    3,          /* number of interfaces in this configuration */
    1,          /* index of this configuration */
    0,          /* configuration name string index */
#if USB_CFG_IS_SELF_POWERED
    USBATTR_SELFPOWER,  /* attributes */
#else
    USBATTR_BUSPOWER,   /* attributes */
#endif
    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units */

    /* IAD descriptor */
    8,
    11,       // bDescriptorType = 11
       0x00,               // bFirstInterface
       0x02,               // bInterfaceCount
       0x02,               // bFunctionClass (Communication Class)
       0x02,               // bFunctionSubClass (Abstract Control Model)
       0x01,               // bFunctionProcotol (V.25ter, Common AT commands)
       0x00,                // iInterface

    /* Test */

    /* interface descriptor follows inline: */
    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE, /* descriptor type */
    0,          /* index of this interface */
    0,          /* alternate setting for this interface */
    USB_CFG_HAVE_INTRIN_ENDPOINT,   /* endpoints excl 0: number of endpoint descriptors to follow */
    USB_CFG_INTERFACE_CLASS,
    USB_CFG_INTERFACE_SUBCLASS,
    USB_CFG_INTERFACE_PROTOCOL,
    0,          /* string index for interface */

    /* CDC Class-Specific descriptor */
    5,           /* sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */
    0x24,        /* descriptor type */
    0,           /* header functional descriptor */
    0x10, 0x01,

    4,           /* sizeof(usbDescrCDC_AcmFn): length of descriptor in bytes */
    0x24,        /* descriptor type */
    2,           /* abstract control management functional descriptor */
    0x02,        /* SET_LINE_CODING,    GET_LINE_CODING, SET_CONTROL_LINE_STATE    */

    5,           /* sizeof(usbDescrCDC_UnionFn): length of descriptor in bytes */
    0x24,        /* descriptor type */
    6,           /* union functional descriptor */
    0,           /* CDC_COMM_INTF_ID */
    1,           /* CDC_DATA_INTF_ID */

    5,           /* sizeof(usbDescrCDC_CallMgtFn): length of descriptor in bytes */
    0x24,        /* descriptor type */
    1,           /* call management functional descriptor */
    3,           /* allow management on data interface, handles call management by itself */
    1,           /* CDC_DATA_INTF_ID */

    /* Endpoint Descriptor */
    7,           /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */
    0x83,        /* IN endpoint number 3 */
    0x03,        /* attrib: Interrupt endpoint */
    8, 0,        /* maximum packet size */
    USB_CFG_INTR_POLL_INTERVAL,        /* in ms */

    /* Interface Descriptor  */
    9,           /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE,           /* descriptor type */
    1,           /* index of this interface */
    0,           /* alternate setting for this interface */
    2,           /* endpoints excl 0: number of endpoint descriptors to follow */
    0x0A,        /* Data Interface Class Codes */
    0,
    0,           /* Data Interface Class Protocol Codes */
    0,           /* string index for interface */

    /* Endpoint Descriptor */
    7,           /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */
    0x01,        /* OUT endpoint number 1 */
    0x02,        /* attrib: Bulk endpoint */
    HW_CDC_BULK_OUT_SIZE, 0,        /* maximum packet size */
    0,           /* in ms */

    /* Endpoint Descriptor */
    7,           /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */
    0x81,        /* IN endpoint number 1 */
    0x02,        /* attrib: Bulk endpoint */
    HW_CDC_BULK_IN_SIZE, 0,        /* maximum packet size */
    0,           /* in ms */

    /* usbasp descriptor */
   9,                  /* sizeof () usbasp descriptor */
   USBDESCR_INTERFACE,      /* descriptor Type */
   2,                  /* index for this interface */
   0,                  /* alternate Setting for this interface */
   0,                  /* number of endpoint descriptros to follow */
   0,                  /* interface class */
   0,                  /* interface subclass */
   0,                  /* interface protocol */
   0,                  /* string index for interface */

};


here's the device descriptor, we changed the device class/subclass as we're using the IAD.

Code: Select all

PROGMEM char usbDescriptorDevice[] = {    /* USB device descriptor */
    18,         /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
    USBDESCR_DEVICE,        /* descriptor type */
    0x10, 0x01,             /* USB version supported */
    0xEF,                /* USB_CFG_DEVICE_CLASS */
    0x02,                /* USB_CFG_DEVICE_SUBCLASS */
    1,                      /* protocol */
    8,                      /* max packet size */
    /* the following two casts affect the first byte of the constant only, but
     * that's sufficient to avoid a warning with the default values.
     */
    (char)USB_CFG_VENDOR_ID,/* 2 bytes */
    (char)USB_CFG_DEVICE_ID,/* 2 bytes */
    USB_CFG_DEVICE_VERSION, /* 2 bytes */
    USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0,         /* manufacturer string index */
    USB_CFG_DESCR_PROPS_STRING_PRODUCT != 0 ? 2 : 0,        /* product string index */
    USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0,  /* serial number string index */
    1,          /* number of configurations */
};

Re: Error while "Select Configuration"

Posted: Thu Oct 08, 2009 10:19 am
by christian
I have not looked in to your descriptors in detail, but I read the comment that you use CDC. You DO know that Vista does not support CDC for low speed devices any more? The spec does not allow bulk endpoints for low speed USB and since Vista Windows enforces this limitation.

It may work in a virtual machine because the USB stuff is bridged. The bridging may convert low speed to full speed, but that's a wild guess.

Re: Error while "Select Configuration"

Posted: Thu Oct 08, 2009 12:00 pm
by Kai.n
so, i checked it. transfers are all ok, the logs are the same on both sides...

yeah i know, but here is a fix for that problem...

but it crashs before that...so we messed the descriptor up?

Re: Error while "Select Configuration"

Posted: Thu Oct 08, 2009 1:23 pm
by christian
I don't know how the fix works and I'm not an expert for descriptors either...

I would guess that it has something to do with the bulk endpoints.