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

sibright

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

#1楼主:求助: 一个具有U盘和USB键盘的设备应该如何设置配置描述符

文章发表于:2008-05-22 04:56

我想做一个设备,同时具有U盘和USB键盘的功能。

分开来的时候两者都是正确的。但是如何把他们整合在一起,是通过在配置描述符里增加一个接口来完成吗?还是怎样完成?有没有哪个高手做过类似的项目?

computer00

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

#2

文章发表于:2008-05-22 17:17

具体没做过。不过应该就是增加一个接口来实现的。这样的设备叫做复合设备。

sibright

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

#3

文章发表于:2008-05-22 17:20

是的。我U盘用的是端点1为IN传输,端点2为OUT 传输。我打算键盘用端点3来传输。接口那里设为2个接口。不知什么问题,连不上设备。

sibright

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

#4

文章发表于:2008-05-22 17:24

    /************** Descriptor of Joystick Mouse interface ****************/
    /* 09 */
    0x09,         /*bLength: Interface Descriptor size*/
    USB_INTERFACE_DESCRIPTOR_TYPE,/*bDescriptorType: Interface descriptor type*/
    0x00,         /*bInterfaceNumber: Number of Interface*/
    0x00,         /*bAlternateSetting: Alternate setting*/
    0x01,         /*bNumEndpoints*/
    0x03,         /*bInterfaceClass: HID*/
    0x01,         /*bInterfaceSubClass : 1=BOOT, 0=no boot*/
    0x02,         /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/
    0,            /*iInterface: Index of string descriptor*/

    0x00,         /*bInterfaceNumber: Number of Interface*/
    0x00,         /*bAlternateSetting: Alternate setting*/

这两项是什么意思?单个接口的时候为什么是0?

 

 

computer00

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

#5

文章发表于:2008-05-22 18:49

你可以看看我的USB MIDI键盘,里面有多个接口。

darkrainbow

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

#6

文章发表于:2008-05-22 18:57

接口的数目应该是在配置描述符设置的吧

sibright

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

#7

文章发表于:2008-05-22 19:27

谢谢 computer00 。我参照了你的USB MIDI键盘,共设置了2个接口,现在U盘可以读写,USB鼠标只能认出来有人体学设备,但驱动没完成。估计是哪里配置还有点问题,我再去改下。

computer00

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

#8

文章发表于:2008-05-22 20:26

估计是HID描述符什么的不对吧,慢慢调试吧。

computer00

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

#9

文章发表于:2008-05-22 20:27

还有报告描述符等。用BUS HOUND分析下数据。

sibright

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

#10

文章发表于:2008-05-22 22:30

const u8 MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC] =
  {

    0x09,   /* bLength: Configuation Descriptor size */
    0x02,   /* bDescriptorType: Configuration */
    MASS_SIZ_CONFIG_DESC,

    0x00,
    0x02,   /* bNumInterfaces: 2 interface */
    0x01,   /* bConfigurationValue: */
    /*      Configuration value */
    0x00,   /* iConfiguration: */
    /*      Index of string descriptor */
    /*      describing the configuration */
    0x80,   /* bmAttributes: */
    /*      bus powered */
    0x32,   /* MaxPower 100 mA: this current is used for detecting Vbus */

    /******************** Descriptor of Mass Storage interface ********************/
    0x09,   /* bLength: Interface Descriptor size */
    0x04,   /* bDescriptorType: */
    /*      Interface descriptor type */
    0x00,   /* bInterfaceNumber: Number of Interface */
    0x00,   /* bAlternateSetting: Alternate setting */
    0x02,   /* bNumEndpoints*/
    0x08,   /* bInterfaceClass: MASS STORAGE Class */
    0x06,   /* bInterfaceSubClass : SCSI transparent*/
    0x50,   /* nInterfaceProtocol */
    4,          /* iInterface: */
    /* 18 */
    0x07,   /*Endpoint descriptor length = 7*/
    0x05,   /*Endpoint descriptor type */
    0x81,   /*Endpoint address (IN, address 1) */
    0x02,   /*Bulk endpoint type */
    0x40,   /*Maximum packet size (64 bytes) */
    0x00,
    0x00,   /*Polling interval in milliseconds */
    /* 25 */
    0x07,   /*Endpoint descriptor length = 7 */
    0x05,   /*Endpoint descriptor type */
    0x02,   /*Endpoint address (OUT, address 2) */
    0x02,   /*Bulk endpoint type */
    0x40,   /*Maximum packet size (64 bytes) */
    0x00,
    0x00,     /*Polling interval in milliseconds*/
    /*32*/
    /************** Descriptor of Joystick Mouse interface ****************/
    0x09,         /*bLength: Interface Descriptor size*/
    0x04,  /*bDescriptorType: Interface descriptor type*/
    0x01,         /*bInterfaceNumber: Number of Interface*/
    0x00,         /*bAlternateSetting: Alternate setting*/
    0x01,         /*bNumEndpoints*/
    0x03,         /*bInterfaceClass: HID*/
    0x01,         /*bInterfaceSubClass : 1=BOOT, 0=no boot*/
    0x02,         /*nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse*/
    0,            /*iInterface: Index of string descriptor*/
    /******************** Descriptor of Joystick Mouse HID ********************/
    0x09,         /*bLength: HID Descriptor size*/
    0x21,      /*bDescriptorType: HID*/
    0x00,         /*bcdHID: HID Class Spec release number*/
    0x01,
    0x00,         /*bCountryCode: Hardware target country*/
    0x01,         /*bNumDescriptors: Number of HID class descriptors to follow*/
    0x22,         /*bDescriptorType*/
    74,      /*wItemLength: Total length of Report descriptor*/
    0x00,
    /******************** Descriptor of Joystick Mouse endpoint ********************/
    0x07,          /*bLength: Endpoint Descriptor size*/
    0x05,      /*bDescriptorType:*/

    0x83,          /*bEndpointAddress: Endpoint Address (IN)*/
    0x03,          /*bmAttributes: Interrupt endpoint*/
    0x04,          /*wMaxPacketSize: 4 Byte max */
    0x00,
    0x20          /*bInterval: Polling Interval (32 ms)*/
  };

 

帮我看下接口和端点定义有没有错。

computer00

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

#11

文章发表于:2008-05-23 02:24

这么长,看着累啊...你可以参看我写的USB键盘。应该只要将端点改改就可以了。

23【下一页】总共 , 当前 /

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

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

回复贴子区

用户名:    您没有注册?

密码:    忘记了密码?

内容:

  • DesignDesign
  • HTMLHTML

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

设计资源与分销