多点触控设备的描述符(原)

code char MouseReportDescriptor[175] = {
0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x04, // USAGE (Touch Screen)

0xa1, 0x01, // COLLECTION (Application)
0x85, 0x02, // REPORT_ID (Touch)
0x09, 0x22, // USAGE (Finger)
0xa1, 0x02, // COLLECTION (Logical)
0x09, 0x42, // USAGE (Tip Switch)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x32, // USAGE (In Range)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x06, // REPORT_COUNT (6)
0x81, 0x03, // INPUT (Cnst,Ary,Abs)
0x75, 0x08, // REPORT_SIZE (8)
0x09, 0x51, // USAGE (Contact Identifier)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)	  
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x15, 0x00,	//LOGICAL_MINIMUM(0)
0x26, 0xff, 0x0f, // LOGICAL_MAXIMUM (4095)
0x75, 0x10, // REPORT_SIZE (16)
0x55, 0x00, // UNIT_EXPONENT (0)
0x65, 0x00, // UNIT (None)
0x09, 0x30, // USAGE (X)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0xff, 0x0f, // PHYSICAL_MAXIMUM (4095)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x46, 0xff, 0x0f, // PHYSICAL_MAXIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0,            // END_COLLECTION

0xa1, 0x02, // COLLECTION (Application)
0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x42, // USAGE (Tip Switch)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x32, // USAGE (In Range)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x06, // REPORT_COUNT (6)
0x81, 0x03, // INPUT (Cnst,Ary,Abs)
0x75, 0x08, // REPORT_SIZE (8)
0x09, 0x51, // USAGE ( Cotact Identifier)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x26, 0xff, 0x0f, // LOGICAL_MAXIMUM (4095)
0x75, 0x10, // REPORT_SIZE (16)
0x55, 0x00, // UNIT_EXPONENT (0)
0x65, 0x00, // UNIT (None)
0x09, 0x30, // USAGE (X)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0xff, 0x0f, // PHYSICAL_MAXIMUM (4095)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x46, 0xff, 0x0f, // PHYSICAL_MAXIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0,         // END_COLLECTION
0x05, 0x0d, // USAGE_PAGE (Digitizers)
0x09, 0x54, // USAGE (Contact Count)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (8)
//0x15, 0x00, // LOGICAL_MINIMUM (0)
//0x25, 0x08, // LOGICAL_MAXIMUM (8)
0x81, 0x02, // INPUT (Data,Var,Abs)

0x85, 0x03, // REPORT_ID (maximum) 
0x09, 0x55, // USAGE(Contact Count Maximum)
0x25, 0x02, //LOGICAL_MINIMUM(2)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0xc0,        // END_COLLECTION
0x09, 0x0e, // USAGE (Device Configuration)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x04, // REPORT_ID (Configuration) 
0x09, 0x23, // USAGE (Device Settings) 
0xa1, 0x02, // COLLECTION (logical) 
0x09, 0x52, // USAGE (Device Mode) 
0x09, 0x53, // USAGE (Device Identifier)
0x15, 0x00, // LOGICAL_MINIMUM (0) 
0x25, 0x0a, // LOGICAL_MAXIMUM (10)
0x75, 0x08, // REPORT_SIZE (8) 
0x95, 0x02, // REPORT_COUNT (2) 
0xb1, 0x02, // FEATURE (Data,Var,Abs) 
0xc0, // END_COLLECTION		
0xc0, // END_COLLECTION   
};

 
//设备描述符
code USB_DEVICE_DESCRIPTOR DeviceDescr =
{
                sizeof(USB_DEVICE_DESCRIPTOR),		//设备描述符长度,= 12H
	USB_DEVICE_DESCRIPTOR_TYPE,		//设备描述符类型,= 01H
	0x10,0x01,				//协议版本,= 1.10
	0,                            //设备类型由接口描述符提供
	0, 0,							//设备子类,设备协议
	EP0_PACKET_SIZE,			//端点0最大数据包大小
	0x71,0x04,				//PHILIPS公司的设备ID	
	0x66,0x05,				//设备制造商定的产品ID
	0x00,0x01,				//设备系列号
	0, 0, 1,				//索引(修改)
	1				//可能的配置数
};


code USB_DESCRIPTOR usb_descr =
{
//配置描述符
{
	sizeof(USB_CONFIGURATION_DESCRIPTOR),	//配置描述符长度,= 09H
	USB_CONFIGURATION_DESCRIPTOR_TYPE,	//配置描述符类型,= 02H
	CONFIG_DESCRIPTOR_LENGTH,0x00,		//描述符总长度, = 002EH
	1,				//只支持1个接口
	1,				//配置值
	0,				//字符串描述符指针(无)
	0x80,				//总线供电
	0x32				//最大功耗(100mA)
},
//接口描述符
{
	sizeof(USB_INTERFACE_DESCRIPTOR),	//接口描述符长度,= 09H
	USB_INTERFACE_DESCRIPTOR_TYPE,		//接口描述符类型,= 04H
	0,				//接口数,只有1个
	0,				//可选配置,只有1个
	0x03,                                      		//人机接口设备(HID)类	
	0,				//使用的子类:(支持boot)  
                  0,						
	0				//字符串描述符索引
},
//hid_descriptor
{
	sizeof(USB_HID_DESCRIPTOR),                     	//HID描述符的字节数大小 0x09
	USB_HID_DESCRIPTOR_TYPE,                                //HID描述符类型编号0x21
	SWAP16(0x0110),			//协议版本,= 1.10
	0x00,                                                  //固件的国家地区代号,0x21为美国  (修改)
	0x02,                                               //下级描述符的数量0x02	
	USB_REPORT_DESCRIPTOR_TYPE,                          //下级描述符为报告描述符0x22
	SWAP16(sizeof(MouseReportDescriptor)),               //下级描述符的长度
},
//端点2输入
	{
		sizeof(USB_ENDPOINT_DESCRIPTOR),   //端点描述符长度,= 07H
		USB_ENDPOINT_DESCRIPTOR_TYPE,	   //端点描述符类型,= 05H
		0x82,			//端点2 OUT
		USB_ENDPOINT_TYPE_INTERRUPT,	//中断传输,= 03H
		EP2_PACKET_SIZE,0x00,		//端点最大包的大小,= 0040H
		0x0A			//中断扫描时间:设置为10ms
	},
//端点2输出
	{
		sizeof(USB_ENDPOINT_DESCRIPTOR),       //端点描述符长度,= 07H
		USB_ENDPOINT_DESCRIPTOR_TYPE,	    //端点描述符类型,= 05H
		0x02,			//端点2 IN	
		USB_ENDPOINT_TYPE_INTERRUPT,	//中断传输,= 03H
		EP2_PACKET_SIZE,0x00,		//端点最大包的大小,= 0040H
		0x0A			//中断扫描时间:设置为10ms
	} 
};

  使用的USB芯片为PDIUSBD12。

posted on 2013-01-04 14:50  nubia101  阅读(1761)  评论(1编辑  收藏  举报

导航