打印

想将一设备枚举成CCID设备,求高手帮忙看看这几个描述符有什么问题?

[复制链接]
2641|4
手机看帖
扫描二维码
随时随地手机跟帖
沙发
xiaojun_|  楼主 | 2013-4-4 23:16 | 只看该作者
本帖最后由 xiaojun_ 于 2013-4-4 23:29 编辑

设备描述符:
USB_DEVICE_DESCRIPTOR  device_descr={
        0x12,
        0x01,        //bDescriptorType: DEVICE
        SWAP(0x0200),        //bcdUSB: usb 2.0
        0,                                // Mass Storage Class
        0,                                //bDeviceSubClass: 0
        0,                                //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                //bMaxPacketSize0: maximum packet size for endpoint zero
        SWAP(0x058F),        //idVendor
        SWAP(0x9540),        //idProduct
        SWAP(0x0100),        //bcdDevice
        0x01,                //iManufacturer: index of string
        0x02,            //iProduct: index of manufacturer string
        0x03,             //iSerialNumber: index of product string
        0x01               //bNumConfigurations: 1 configuration
};

BusHound显示如下:
XP端显示如下:





QQ截图20130404232239.png (18.14 KB )

QQ截图20130404232239.png

使用特权

评论回复
板凳
xiaojun_|  楼主 | 2013-4-4 23:18 | 只看该作者
配置描述符:
USB_CONFIGURATION_DESCRIPTOR  config_descr = {
        0x09,        //bLength
        0x02,        //bDescriptor 02
        SWAP(0x005d),        //wTotalLength  86=0x0056   32=0x0020  93=0x5d
        0x01,                //bNumInterface
        0x01,                //bConfiguration Value
        0x00,                        //iConfiguration
        0x80,                        //bmAttributes,BUS-POWER
        0xfa                        //bMaxPower,500mA
};

接口描述符:
USB_INTERFACE_DESCRIPTOR inter_descr = {
        0x09,                //bLength: 0x09 bytes
        0x04,                //bDescriptorType: INTERFACE
        0x00,           //bInterfaceNumber: interface 0
        0x00,           //bAlternateSetting: alternate setting 0
        0x03,           //bNumEndpoints: 2 endpoint ,not include zero ep
        0x0B,
        0x00,
        0x00,
        0x00            //iInterface: index of string
};


使用特权

评论回复
地板
xiaojun_|  楼主 | 2013-4-4 23:20 | 只看该作者
CCID类描述符:
BYTE ccid_descr[0x36] = {

        0x36,                // bLength: CCID Descriptor size
        0x21,                // bDescriptorType: HID To be updated with CCID specific number
        0x00,0x01,// bcdCCID 0x0110
        0x00,                // bMaxSlotIndex
        0x07,                // bVoltageSupport: 5v, 3v and 1.8v
        0x01,0x00,0x00,0x00,        // dwProtocols: supports T=0 and T=1
        0xA0,0x0F,0x00,0x00,        // dwDefaultClock: 4 Mhz (0x00000FA0)
        0xA0,0x0F,0x00,0x00,        // dwMaximumClock: 4 Mhz (0x00000FA0)
        0x00,                                        // bNumClockSupported => no manual setting
        0x80,0x25,0x00,0x00,        // dwDataRate: 9600 bps (0x00002A00)
        0x80,0x25,0x00,0x00,        // dwMaxDataRate: 9600 bps (0x0001F808)
        0x00,                                        // bNumDataRatesSupported => no manual setting
        0xfe,0x00,0x00,0x00,   /* dwMaxIFSD: 0 (T=0 only)   */
        0x00,0x00,0x00,0x00, /* dwSynchProtocols  */
        0x00,0x00,0x00,0x00,  /* dwMechanical: no special characteristics */
        0x30,0x00,0x01,0x00,        // dwFeatures: clk, baud rate, voltage : automatic CCID can set ICC in clock stop mode.
        0x0f,0x01,0x00,0x00,         /* dwMaxCCIDMessageLength : Maximun block size + header*/ /* 261 + 10   */                                             
        0x00,                        /* bClassGetResponse*/
        0x00,                        /* bClassEnvelope */
        0x00,0x00,                /* wLcdLayout */
        0x00,                        /* bPINSupport : no PIN verif and modif  */
        0x01         // bMaxCCIDBusySlot
       
};

使用特权

评论回复
5
xiaojun_|  楼主 | 2013-4-4 23:21 | 只看该作者
端点描述符://Endpoint 1
USB_ENDPOINT_DESCRIPTOR ep_descr_in = {
        0x07,                        //bLength: 0x07 bytes
        0x05,                   //bDescriptorType: ENDPOINT
        0x81,                   //bEndpointAddress: IN endpoint 1
        0x02,                   //bmAttributes: BULK-ONLY(00:Control 01:isoch 10:bulk 11:intr
        SWAP(0x0040),           //wMaxPacketSize: 64 bytes
        0x00                    //bInterval: polling interval is 1 ms
};

//Endpoint1
USB_ENDPOINT_DESCRIPTOR ep_descr_out = {
         0x07,                   //bLength: 0x07 bytes
         0x05,                   //bDescriptorType: ENDPOINT
         0x01,                   //bEndpointAddress: out endpoint 1
         0x02,                   //bmAttributes: BULK-ONLY
         SWAP(0x0040),           //wMaxPacketSize: 64 bytes
         0x00                        //bInterval: polling interval is 1 ms
};

USB_ENDPOINT_DESCRIPTOR ep_descr_intr = {
         0x07,                   //bLength: 0x07 bytes
         0x05,                   //bDescriptorType: ENDPOINT
         0x82,                   //bEndpointAddress: int endpoint 2
         0x03,                   //bmAttributes: intr
         SWAP(0x0010),           //wMaxPacketSize: 64 bytes
         0x18                        //bInterval: polling interval is 24 ms
};

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

19

帖子

1

粉丝