Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2093404
  • 博文数量: 361
  • 博客积分: 10828
  • 博客等级: 上将
  • 技术积分: 4161
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-20 14:34
文章分类

全部博文(361)

文章存档

2011年(132)

2010年(229)

分类: LINUX

2011-05-18 18:03:16

一、HID接口:
OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType104hInterface
2bInterfaceNumber103h
3bAlternateSetting100h
4bNumEndpoints102h
5bInterfaceClass103hHID
6bInterfaceSubClass100h
7bInterfaceProtocol100h
8iInterface100h



其中:
bLength:为接口描述符的长度。
bDescriptorType:表明其是接口。
bInterfaceNumber:表示第几个接口,此处为3,表明前面定义了3个接口。
bAlternateSetting:指明可选设置的索引值。意思是如果此设备只有一种接口,但是有两个可选设置,那么这两个设置的bInterfaceNumber值必须相同,且bAlternateSetting值必须不同。
bNumEndpoints:指明接口使用的端点数目,不包括端点0
bInterfaceClass:指类类型,可以为以下类。1:音频类,2CDC控制类,3:人机接口类(HID),5:物理类,6:图像类,7:打印机类,8:大数据存储类,9:集线器类,10CDC数据类,11:智能卡类,13:安全类,220:诊断设备类,224:无线控制类,254:特定应用类,255厂商定义的设备。
bInterfaceSubClass:子类。HID中含义:
bInterfaceSubClass(含义)
0 No Subclass 
1 Boot Interface Subclass 
2 - 255 Reserved 
bInterfaceProtocol:协议。HID中含义:
bInterfaceProtocol(含义)
0 None 
1 Keyboard 
2 Mouse 
3 - 255 Reserved 

因此,此表明其是HID类,没有子类和不使用协议。

二、HID 端点
OffsetFieldSizeValueDescription
0bLength107h
1bDescriptorType105hEndpoint
2bEndpointAddress183h3 In
3bmAttributes103hInterrupt
1..0: Transfer Type......11 Interrupt
7..2: Reserved000000.. 
4wMaxPacketSize20008h8 bytes
6bInterval108h8 ms
OffsetFieldSizeValueDescription
0bLength107h
1bDescriptorType105hEndpoint
2bEndpointAddress104h4 Out
3bmAttributes103hInterrupt
1..0: Transfer Type......11 Interrupt
7..2: Reserved000000.. 
4wMaxPacketSize20040h64 bytes
6bInterval108h8 ms


HID设备与HID驱动通讯
HID设备与HID驱动通讯要么使用控制端点,要么使用中断端点。
控制端点作用:
a 发送命令给HID设备,
b 发送数据给HID设备。

中断端点作用:
a 用来接收来自设备的数据
b 用来给设备发送数据

输出中断端点是可选的,没有的话,用控制端点传送。

三、HID描述符
OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType121hHID
2bcdHID20111h1.11
4bCountryCode100h
5bNumDescriptors101h
6bDescriptorType122hReport
7wDescriptorLength20211h529 bytes

bLength:报告描述符长度(字节) 
bDescriptorType:描述符类型:0x21(设备描述符  1 ;  配置描述符  2; 字符串描述符  3; 接
口描述符  4;  端点描述符  5;  设备限定描述符  6 ; 其他速率配置描述符  7 ;)
bcdHID:HID 版本号(BCD 码) 
bCountryCode:国家/地区代码
bNumDescriptor:支持的其他类型描述符数量
bDescriptorType:类别描述符的类型
wDescriptorLength:报告描述符的总长度 

阅读(4018) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~