I am using V-USB on ATTiny2313 and want to emulate a USB-Soundcard. For this reseaon I need to provide an in-endpoint 1 with transfer-type bulk. I built my firmware with the V-USB example "Custom Class" and implemened my own configuration descriptor (including a interface descriptor and a endpoint descriptor) in my flash data memory. Archiving the described behavior I set the properties-flags in usbconfig.h:
Code: Select all
#define CONFIGURATION_DESCRIPTOR_SIZE 25
#define USB_CFG_DESCR_PROPS_CONFIGURATION (USB_PROP_LENGTH(CONFIGURATION_DESCRIPTOR_SIZE))
Further, I defined my descriptors in main.c:
Code: Select all
PROGMEM char usbDescriptorConfiguration[CONFIGURATION_DESCRIPTOR_SIZE] = {
/* USB configuration descriptor */
9, /* length of descriptor in bytes */
2, /* descriptor type, 2==ConfigurationDescriptor */
18, /* total length of data returned, including inline descriptors byte 1*/
0, /* total length of data returned, including inline descriptors byte 2 */
1, /* number of interfaces in this configuration */
1, /* index of this configuration */
0, /* configuration name string index */
(1 << 7), /* attributes for device is not self-powered */
40/2, /* max USB current in 2mA units */
/* interface descriptor follows inline: */
9, /* length of descriptor in bytes */
4, /* descriptor type, 4==InterfaceDescriptor */
0, /* index of this interface */
1, /* alternate setting for this interface */
1, /* endpoints excl 0: number of endpoint descriptors to follow */
0, /* Interface class configured at device-descriptor level */
0, /* Interface subclass configured at device-descriptor level */
0, /* Interface protocol configured at device level */
0, /* string index for interface */ /* ----> maybe belongs to endpoint descriptor */
/* endpoint descriptor follows inline: */
7, /* length of endpoint descriptor */
5, /* descriptor type, 5==EndpointDescriptor */
(char)0x81, /* IN endpoint number 1 */
0x02, /* attributes for endpoint (bulk-in) */
8, /* maximum packet size byte 1*/
0, /* maximum packet size byte 2*/
0 /* interrupt poll interval in ms, ingnored on other */
};
So far my "USB-Soundcard" is identified by my linux host PC, kernel module is loaded but the probing fails because, I guess, the USB-Core does not receive my descriptors properly.
dmesg says:
Code: Select all
[686983.913097] usb 3-1.1: new low speed USB device using ohci_hcd and address 47
[686984.018124] usb 3-1.1: config 1 interface 0 altsetting 1 has 0 endpoint descriptors, different from the interface descriptor's value: 1
[686984.018131] usb 3-1.1: config 1 interface 0 has no altsetting 0
[686984.031299] usb 3-1.1: configuration #1 chosen from 1 choice
[686984.059164] snd-usb: probe of 3-1.1:1.0 failed with error -5
[686984.059254] usbcore: registered new interface driver snd-usb-caia
First I thouth about some compiler optimizations of my PROGMEM-array, but now almost every optimization-level is deactivated. Any suggestions about the reason why my endpoint descriptor seems wrong?
Do I count the size of my PROGMEM-array wrong (=25)?
Kind Regards,
Tommy