配置描述符更改后无法识别USB设备

时间:2014-05-03 16:24:26

标签: usb microcontroller cdc virtual-serial-port

我尝试实现USB设备。有一个实现HID的示例代码。我更改了配置描述符,设备从设备中消失了(lsusb)我不知道出了什么问题,因为我根据CDC文档制作了它。这是配置描述符:

static unsigned char ConfigDescr[]= // CONFIGURATION Descriptor
{
    0x09,       // bLength
    0x02,       // bDescriptorType = Config
    0x43,0x00,  // wTotalLength(L/H) = 67 bytes
    0x02,       // bNumInterfaces
    0x01,       // bConfigValue
    0x00,       // iConfiguration
    0xE0,       // bmAttributes. b7=1 b6=self-powered b5=RWU supported
    0x01,       // MaxPower is 2 ma
// INTERFACE Descriptor
    0x09,       // length = 9
    0x04,       // type = IF
    0x00,       // IF #0
    0x00,       // bAlternate Setting
    0x01,       // bNum Endpoints
    0x02,       // bInterfaceClass = Communucations
    0x02,0x01,  // bInterfaceSubClass=Abstract (modem), bInterfaceProtocol=AT-commands (v.25ter)
    0x00,       // iInterface
// CDC header
    0x05,           // bFunctionLength = 5
    0x24,           // bDescriptorType = CS_INTERFACE 24h
    0x00,           // bDescriptorSubtype = Header Functional Descriptor
    0x10, 0x01,     // bcdCDC
// CDC Call Management
    0x05,           // bFunctionLength = 5
    0x24,           // bDescriptorType = CS_INTERFACE 24h
    0x01,           // bDescriptorSubtype = Call Management
    0x00,           // bmCapabilities = 0x00
    0x01,           // bDataInterface
// CDC Abstract Control Model
    0x04,           // bFunctionLength = 4
    0x24,           // bDescriptorType = CS_INTERFACE 24h
    0x02,           // bDescriptorSubtype = ACM
    0x02,           // bmCapabilities = 0x02
// CDC Union
    0x05,           // bFunctionLength = 5
    0x24,           // bDescriptorType = CS_INTERFACE 24h
    0x06,           // bDescriptorSubtype = Union Functional Descriptor
    0x00,           // bMasterInterface
    0x01,           // bSlaveInterface
//Endpoint Descriptor
    0x07,       // bLength = 7
    0x05,       // bDescriptorType (Endpoint)
    0x83,       // bEndpointAddress (EP3-IN)
    0x03,       // bmAttributes (interrupt)
    8,0,           // wMaxPacketSize (8)  // 8
    255,        // bInterval (poll every 10 msec)
// Interface Descriptor
    0x09,       // length = 9
    0x04,       // type = IF
    0x01,       // IF #1
    0x00,       // bAlternate Setting
    0x02,       // bNum Endpoints
    0x0a,       // bInterfaceClass = CDC Data interface
    0x00,0x00,  // bInterfaceSubClass=unused, bInterfaceProtocol=no protocol needed
    0x00,       // iInterface
// Endpoint Descriptor
    0x07,       // bLength
    0x05,       // bDescriptorType (Endpoint)
    0x01,       // bEndpointAddress (EP1-OUT)
    0x02,       // bmAttributes (bulk)
    64,0,           // wMaxPacketSize (64)
    0,      // bInterval
// Endpoint Descriptor
    0x07,       // bLength
    0x05,       // bDescriptorType (Endpoint)
    0x81,       // bEndpointAddress (EP1-IN)
    0x02,       // bmAttributes (bulk)
    64,0,           // wMaxPacketSize (64)
    0};     // bInterval

1 个答案:

答案 0 :(得分:0)

最后,我从制造商处获得了新的USB库,因为有一个旧代码。这解决了我的问题,所以我关闭了这个问题。谢谢你的帮助!