I'm trying to figure out your problem with the size of the Config Descriptor, but fail to see the problem.
The size depends on the number of endpoints described in it, and it will be even when an even number of endpoints is described. The number of endpoints is given in the Interface Descriptor, and needs to match the number of Endpoint Descriptors that follow.
When there is a mismatch between these the host will not enumerate the device.
So when changing the Config Descriptor to add or remove an endpoint make sure to correct the number in the Interface Descriptor.
//USB Configuration Descriptor
const uint8_t ConfigDescriptor[] =
{
0x09, // bLength: Configuration Descriptor size
0x02, // bDescriptorType: Configuration
0x27, // wTotalLength:no of returned bytes
0x00,
0x01, // bNumInterfaces: 1 interface
0x01, // bConfigurationValue: Configuration value
0x00, // iConfiguration: Index of string descriptor describing the configuration
0x80, // bmAttributes: self powered
0x31, // MaxPower 98 mA
//Interface Descriptor
0x09, // bLength: Interface Descriptor size
0x04, // bDescriptorType: Interface
// Interface descriptor type
0x00, // bInterfaceNumber: Number of Interface
0x00, // bAlternateSetting: Alternate setting
0x03, // bNumEndpoints: 3 endpoints used !!!!!!! This needs to be changed when the number of endpoints changes !!!!!!!!
0xFF, // bInterfaceClass: Vendor Interface Class
0x01, // bInterfaceSubClass
0x02, // bInterfaceProtocol
0x00, // iInterface:
//Endpoint 2 IN Descriptor
0x07, // bLength: Endpoint Descriptor size
0x05, // bDescriptorType: Endpoint
0x82, // bEndpointAddress: (IN2)
0x02, // bmAttributes: Bulk
0x20, // wMaxPacketSize:
0x00,
0x00, // bInterval:
//Endpoint 2 OUT Descriptor
0x07, // bLength: Endpoint Descriptor size
0x05, // bDescriptorType: Endpoint
0x02, // bEndpointAddress: (OUT2)
0x02, // bmAttributes: Bulk
0x20, // wMaxPacketSize:
0x00,
0x00, // bInterval: ignore for Bulk transfer
//Endpoint 1 IN Descriptor
0x07, // bLength: Endpoint Descriptor size
0x05, // bDescriptorType: Endpoint
0x81, // bEndpointAddress: (IN1)
0x03, // bmAttributes: Interrupt
0x08, // wMaxPacketSize:
0x00,
0x01 // bInterval
};