返回该小组首页 回复主题
jackbao

jackbao

小组等级:     E币:173  (E币换礼)

#1楼主:usb实现一插上usb电脑设备管理器多出两个com口

文章发表于:2008-07-01 07:26


const u8 Virtual_Com_Port_ConfigDescriptor[] =
  {
    /*Configuation Descriptor*/
    0x09,   /* bLength: Configuation Descriptor size */
    USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */
    VIRTUAL_COM_PORT_SIZ_CONFIG_DESC,       /* wTotalLength:no of returned bytes */
    0x00,
    0x02,   /* bNumInterfaces: 2 interface */
    0x01,   /* bConfigurationValue: Configuration value */
    0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
    0xC0,   /* bmAttributes: self powered */
    0x00,   /* MaxPower 0 mA */
    /*Interface Descriptor*/
    0x09,   /* bLength: Interface Descriptor size */
    USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
    /* Interface descriptor type */
    0x00,   /* bInterfaceNumber: Number of Interface */
    0x00,   /* bAlternateSetting: Alternate setting */
    0x01,   /* bNumEndpoints: One endpoints used */
    0x02,   /* bInterfaceClass: Communication Interface Class */
    0x02,   /* bInterfaceSubClass: Abstract Control Model */
    0x01,   /* bInterfaceProtocol: Common AT commands */
    0x00,   /* iInterface: */
    /*Header Functional Descriptor*/
    0x05,   /* bLength: Endpoint Descriptor size */
    0x24,   /* bDescriptorType: CS_INTERFACE */
    0x00,   /* bDescriptorSubtype: Header Func Desc */
    0x10,   /* bcdCDC: spec release number */
    0x01,
    /*Call Managment Functional Descriptor*/
    0x05,   /* bFunctionLength */
    0x24,   /* bDescriptorType: CS_INTERFACE */
    0x01,   /* bDescriptorSubtype: Call Management Func Desc */
    0x00,   /* bmCapabilities: D0+D1 */
    0x01,   /* bDataInterface: 1 */
    /*ACM Functional Descriptor*/
    0x04,   /* bFunctionLength */
    0x24,   /* bDescriptorType: CS_INTERFACE */
    0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
    0x02,   /* bmCapabilities */
    /*Union Functional Descriptor*/
    0x05,   /* bFunctionLength */
    0x24,   /* bDescriptorType: CS_INTERFACE */
    0x06,   /* bDescriptorSubtype: Union func desc */
    0x00,   /* bMasterInterface: Communication class interface */
    0x01,   /* bSlaveInterface0: Data Class Interface */
    /*Endpoint 2 Descriptor*/
    0x07,   /* bLength: Endpoint Descriptor size */
    USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    0x82,   /* bEndpointAddress: (IN2) */
    0x03,   /* bmAttributes: Interrupt */
    VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */
    0x00,
    0xFF,   /* bInterval: */
    /*Data class interface descriptor*/
    0x09,   /* bLength: Endpoint Descriptor size */
    USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
    0x01,   /* bInterfaceNumber: Number of Interface */
    0x00,   /* bAlternateSetting: Alternate setting */
    0x02,   /* bNumEndpoints: Two endpoints used */
    0x0A,   /* bInterfaceClass: CDC */
    0x00,   /* bInterfaceSubClass: */
    0x00,   /* bInterfaceProtocol: */
    0x00,   /* iInterface: */
    /*Endpoint 3 Descriptor*/
    0x07,   /* bLength: Endpoint Descriptor size */
    USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    0x03,   /* bEndpointAddress: (OUT3) */
    0x02,   /* bmAttributes: Bulk */
    VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
    0x00,
    0x00,   /* bInterval: ignore for Bulk transfer */
    /*Endpoint 1 Descriptor*/
    0x07,   /* bLength: Endpoint Descriptor size */
    USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    0x81,   /* bEndpointAddress: (IN1) */
    0x02,   /* bmAttributes: Bulk */
    VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
    0x00,
    0x00    /* bInterval */
  };
上面的描述  实现了一个usb插上设备中出现一个com口,如果要实现一插上usb设备管理器  出现两个com口  怎么实现?
  要多定义接口?还是怎么改描述呢?请圈圈和高手帮忙。

很急  要命了快

computer00

   小组等级:    E币:10072  (E币换礼)

#2

文章发表于:2008-07-01 21:50

将接口描述符以下的复制一遍,然后修改相应的接口号、端点描述符、配置描述符中的总长度、配置描述符指定的接口数量等等等。

jackbao

   小组等级:    E币:173  (E币换礼)

#3

文章发表于:2008-07-02 09:18

圈圈  我可以只增加接口  但是使用上面接口一样的端点吗

computer00

   小组等级:    E币:10072  (E币换礼)

#4

文章发表于:2008-07-02 09:31

绝对不可以,端点必须要不一样。

jackbao

   小组等级:    E币:173  (E币换礼)

#5

文章发表于:2008-07-02 09:52

那样的话  关于端点还要设置什么 

 我没改端点  插上就蓝屏从启

  圈圈呀  帮帮我呀  崩溃了

jackbao

   小组等级:    E币:173  (E币换礼)

#6

文章发表于:2008-07-02 12:00

圈圈 帮帮我呀

computer00

   小组等级:    E币:10072  (E币换礼)

#7

文章发表于:2008-07-02 16:09

我不确认系统自带的驱动是否可以支持转成多个串口的……

你这里一个接口使用了3个端点,分别是IN1、IN2、OUT3。

如果你还要另外一个接口的话,还需要另外三个端点。IN4、IN5、OUT6。但是恐怕你的器件没这么多端点。

如下设置看行不:接口1:IN1(中断),IN2、OUT2(批量)。

接口2:IN3(中断),IN4,OUT4(批量)。

 

另外,这个中断端点好象不是必须的,如果端点不够还可以考虑将中断端点拿掉试试……

具体如何做,只能靠你自己去看资料、尝试了。我没做过,细节不清楚。

kz19830131

   小组等级:    E币:59  (E币换礼)

#8

文章发表于:2008-07-02 19:12

呵呵。不怎么会

总共 , 当前 /

快速回复主题--如果想加入编辑器功能,建议使用 [高级回复]

您目前还不是小组成员,请先加入

回复贴子区

用户名:    您没有注册?

密码:    忘记了密码?

内容:

浏览该小组的用户还看过...

设计资源与分销