ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Воскресенье
21 июля
321432 Топик полностью
йцукен (08.04.2012 15:25, просмотров: 1) ответил RED_DRAGON на Господа, можете ли присоветовать визард усб-дискрипторов? Или поделиться кому не жалко дескрипторами композитного дивайса.
Про визард не слышал, но вообще в дескрипторах композитного девайса ничего военного нет. В Confifuration Descriptor есть поле, куда вписывается количество интерфейсов, потом идут дескрипторы самих интерфейсов и их эндпоинтов. Ниже примеры дескрипторов устройств с одним и тремя HID интерфейсами (увы, форматирование съедет). Если спецификация класса требует больше одного интерфейса (как у гадского CDC), аффтару реккомендуется выпить IAD http://msdn.micros …dware/ff540054(v=vs.85).aspx#pragma pack(1)struct UsbDeviceDescriptor {uint8_tLength;// size of this descriptor in bytesuint8_tType;// DEVICE descriptor typeuint16_tbcdUSB;// USB Specification releaseuint8_tClass;// Class code assigned by the USBuint8_tSubClass;// Sub-class code assigned by the USBuint8_tProtocol;// Protocol code assigned by the USBuint8_tEp0Size;// Max packet size for EP0uint16_tidVendor;// Vendor ID. ATMEL = 0x03EBuint16_tidProduct;// Product ID assigned by the manufactureruint16_tbcdDevice;// Device release numberuint8_tiManufacturer;// Index of manu. string descriptoruint8_tiProduct;// Index of prod. string descriptoruint8_tiSerialNumber;// Index of S.N. string descriptoruint8_tnConfigurations;// Number of possible configurations};struct UsbConfigurationDescriptor {uint8_tLength;// size of this descriptor in bytesuint8_tType;// CONFIGURATION descriptor typeuint16_twTotalLength;// size of configiration descriptor// plus all descriptors relevant to// this configurationuint8_tnInterfaces;// number of interfaces for this conf.uint8_tConfigNum;// value for SetConfiguration requestuint8_tiConfiguration;// index of string descriptoruint8_tbmAttibutes;// Configuration characteristicsuint8_tMaxPower;// Imax = 2*MaxPower};struct UsbInterfaceDescriptor {uint8_tLength;// size of this descriptor in bytesuint8_tType;// INTERFACE descriptor typeuint8_tInterfaceNum;// number of this interfaceuint8_tAlternateSetting;//?? value to select alternate settinguint8_tnEndpoints;// used endpoints (except EP0)uint8_tClass;// Class code assigned by the USBuint8_tSubClass;// Sub-class code assigned by the USBuint8_tProtocol;// Protocol code assigned by the USBuint8_tiInterface;// Index of string descriptor};struct UsbEndpointDescriptor {uint8_tLength;// size of this descriptor in bytesuint8_tType;// ENDPOINT descriptor typeuint8_tEndpointAddress;uint8_tbmAttributes;// Endpoint's attributesuint16_twMaxPacketSize;uint8_tInterval;// Interval in ms for polling interrupt EP};struct UsbHidDescriptor1 {uint8_tLength;// size of this descriptor in bytesuint8_tType;// HID_DESCRIPTORuint16_tbcdHID;// version of HID specuint8_tCountryCode;// 0 = noneuint8_tnSubordinate;// uint8_tSub1Type;// 1st subordinate descriptor typeuint16_tSub1Length;// 1st subordinate descriptor length};struct UsbConfigDescriptorHID {UsbConfigurationDescriptorCfg;UsbInterfaceDescriptorIfc;UsbHidDescriptor1Hid;UsbEndpointDescriptorEpIn;UsbEndpointDescriptorEpOut;};struct UsbConfigDescriptor3HID {UsbConfigurationDescriptorCfg;UsbInterfaceDescriptorIfc0;UsbHidDescriptor1Hid0;UsbEndpointDescriptorEpIn0;UsbEndpointDescriptorEpOut0;UsbInterfaceDescriptorIfc1;UsbHidDescriptor1Hid1;UsbEndpointDescriptorEpIn1;UsbEndpointDescriptorEpOut1;UsbInterfaceDescriptorIfc2;UsbHidDescriptor1Hid2;UsbEndpointDescriptorEpIn2;UsbEndpointDescriptorEpOut2;};