clementzhao
驱动大牛
驱动大牛
  • 注册日期2003-05-08
  • 最后登录2009-02-20
  • 粉丝0
  • 关注0
  • 积分28分
  • 威望63点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
阅读:2271回复:2

USB serial,usb模拟串口

楼主#
更多 发布于:2008-03-07 10:50
正在做usb模拟串口的设备,按照协议写了驱动,PC xp也能正确识别了。通讯时接受数据没问题,不过只能往pc发送数据一次。有谁做过或者有这类型的设备,给点建议或者bushound的数据,谢谢。

描述符:
static T_U8 deviceDescrCDC[] = {    /* USB device descriptor */
    18,                    /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
    DEVICE_DESC_TYPE,      /* descriptor type */
    0x10, 0x01,            /* USB version supported */
    0x02,                  /* device class: CDC */
    0,                      /* subclass */
    0,                      /* protocol */
    64,                   /* max packet size */
    0x71, 0x04,            /* 2 bytes */
    0x77, 0x07,            /* 2 bytes: shared PID for CDC-ACM devices */
    0x00, 0x01,            /* 2 bytes */
    0,                      /* manufacturer string index */
    0,                      /* product string index */
    0,                      /* serial number string index */
    1,                      /* number of configurations */
};

static T_U8 configDescrCDC[] = {  /* USB configuration descriptor */
    9,          /* sizeof(usbDescrConfig): length of descriptor in bytes */
    2,          /* descriptor type */
    67,
    0,          /* total length of data returned (including inlined descriptors) */
    2,          /* number of interfaces in this configuration */
    1,          /* index of this configuration */
    0,          /* configuration name string index */
    0x80,
    50,          /* max USB current in 2mA units */

    /* interface descriptor follows inline: */
    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    4,          /* descriptor type */
    0,          /* index of this interface */
    0,          /* alternate setting for this interface */
    1,          /* endpoints excl 0: number of endpoint descriptors to follow */
    0x02,      /* CDC class */
    2,          /* Abstract (Modem) */
    //1,          /* AT-Commands */
    0,          /* No protocol code */
    0,          /* string index for interface */

    /* CDC Class-Specific descriptor */
    5,          /* sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */
    0x24,        /* descriptor type */
    0,          /* header functional descriptor */
    0x10, 0x01,

    5,          /* Size of this descriptor */
    0x24,      /* CS_INTERFACE type */
    1,          /* Call management descriptor */
    0x01,      /* Call management is handled by the device */
    0x01,      /* Data interface is 0x01 */

    4,          /* Size of this descriptor */
    0x24,      /* CS_INTERFACE type */
    2,          /* Abstract control management functional descriptor */
    7,          /* Every request/notification except NetworkConnection supported */

    5,          /* Size of this descriptor */
    0x24,      /* CS_INTERFACE type */
    6,          /* union functional descriptor */
    0x00,      /* Master interface is 0x00 (Communication class interface) */
    0x01,      /* First slave interface is 0x01 */

    /* Endpoint Descriptor */
    7,          /* sizeof(usbDescrEndpoint) */
    5,          /* descriptor type = endpoint */
    0x81,        /* IN endpoint number 1 */
    0x03,        /* attrib: Interrupt endpoint */
    64, 0,      /* maximum packet size */
    10,          /* in ms */

    /* Interface Descriptor  */
    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    4,          /* descriptor type */
    1,          /* index of this interface */
    0,          /* alternate setting for this interface */
    2,          /* endpoints excl 0: number of endpoint descriptors to follow */
    0x0A,        /* Data Interface Class Codes */
    0,
    0,          /* Data Interface Class Protocol Codes */
    0,          /* string index for interface */

    /* Endpoint Descriptor */
    7,          /* sizeof(usbDescrEndpoint) */
    5,          /* descriptor type = endpoint */
    0x03,        /* OUT endpoint number 3 */
    0x02,        /* attrib: Bulk endpoint */
    64,  
    0,          /* maximum packet size */
    0,          /* in ms */

    /* Endpoint Descriptor */
    7,          /* sizeof(usbDescrEndpoint) */
    5,          /* descriptor type = endpoint */
    0x82,        /* IN endpoint number 2 */
    0x02,        /* attrib: Bulk endpoint */
    64,
    0,          /* maximum packet size */
    0,          /* in ms */
};
shaohaigod
驱动牛犊
驱动牛犊
  • 注册日期2007-06-13
  • 最后登录2009-03-04
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望21点
  • 贡献值0点
  • 好评度10点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2008-05-09 09:13
LZ 厉害

能不能把你的驱动源码给我一份,小弟也正在搞这个,先谢谢了,,以后多交流
shaohaigod@163.com
qq:3162581
eda_gb
驱动牛犊
驱动牛犊
  • 注册日期2008-05-25
  • 最后登录2010-10-24
  • 粉丝0
  • 关注0
  • 积分143分
  • 威望35点
  • 贡献值0点
  • 好评度14点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2008-05-25 16:49
能不能把你的驱动源码给我一份,小弟也正在搞这个,先谢谢了,,以后多交流
guobo120120@163.com
游客

返回顶部