📄 usb2ps2.h
字号:
static unsigned char code dev_desc_table[] = {
0x12,
0x01, //device descriptor type
0x10, //V1.10
0x01,
0x00, //device class
0x00, //device sub-class
0x00, //device protocal
0x08, //endpoint0 max.PktSz
0x7a, //vid 0x177a=explore,
0x17,
0x00, //pid
0x0f,
0x00,
0x0f, //bcd-device
0x01, //iManufacturer
0x02, //iProduct
0x00, //iSerial
0x01 //number of possible config
};
static unsigned char code conf_desc_table[] = {
0x09,
0x02, //configuration descriptor type
0x3b, //wTotoalLen
0x00,
0x02, //number of interface
0x01, //Config value
0x00, //iConfig
0xA0, //bus-power, remote-wakeup
0x32, //50x2ma=100ma
//
// intf0_desc_table
//
0x09,
0x04, //interface descriptor type
0x00, //interface 0
0x00, //alternate setting 0
0x01, //number of endpoint
0x03, //HID interface class code
0x01, //boot interface sub-class code
0x01, //keyboard
0x00, //iInterface
//
// keyboard_hid_desc_table
//
0x09,
0x21, //HID descriptor type
0x10, //bcdHID=version V1.10
0x01, //
0x00, //Hardware target country(Not support!)
0x01, //number of HID class descriptors to follow
0x22, //report type
0x40, //report len (two bytes):64 bytes
0x00,
// ep1_desc_table
0x07,
0x05, //endpoint descriptor type
0x81, //IN endpoint 1
0x03, //Interrupt transfer type
0x08, //maxPktSz=0x0008
0x00, //
0x0A, //polling interval = 10ms
//
// intf1_desc_table
//
0x09,
0x04, //interface descriptor type
0x01, //interface 1
0x00, //alternate setting 0
0x01, //number of endpoint
0x03, //HID interface class code
0x01, //boot interface sub-class code
0x02, //mouse
0x00, //iInterface
//
// mouse_hid_desc_table
//
0x09,
0x21, //HID descriptor type
0x10, //bcdHID=version V1.10
0x01, //
0x00, //Hardware target country(Not support!)
0x01, //number of HID class descriptors to follow
0x22, //report type
0x66, //report len (two bytes):102 bytes
0x00,
// ep2_desc_table
0x07,
0x05, //endpoint descriptor type
0x82, //IN endpoint 2
0x03, //Interrupt transfer type
0x08, //maxPktSz=0x0008
0x00, //
0x0A, //polling interval = 10ms
};
static unsigned char code str0_table[] = {
0x04,
0x03,
0x09,
0x04
};
static unsigned char code str1_table[] = {
0x18,
0x03,
'E',
0x00,
'S',
0x00,
'I',
0x00,
':',
0x00,
'E',
0x00,
'P',
0x00,
'F',
0x00,
'0',
0x00,
'0',
0x00,
'1',
0x00,
'.',
0x00
};
static unsigned char code str2_table[] = {
0x16,
0x03,
'P',
0x00,
'S',
0x00,
'2',
0x00,
' ',
0x00,
'b',
0x00,
'r',
0x00,
'i',
0x00,
'd',
0x00,
'g',
0x00,
'e',
0x00
};
static unsigned char code keyboard_report[] = {
0x05, 0x01, //Usage Page (Generic Desktop Control)
0x09, 0x06, //Usage (KeyBoard)
0xA1, 0x01, //Collection (Application)
0x05, 0x07, // Usage Page (Keyboard/Keypad Keys)
0x19, 0xE0, // Usage Minimum (224)
0x29, 0xE7, // Usage Maximum (231)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x08, // Report Count (8)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input(Data, Variable, Absolute)
0x95, 0x01, // Report Count (1)
0x75, 0x08, // Report Size (8)
0x81, 0x01, // Input(Constant)
0x05, 0x08, // Usage Page (LED)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x03, // Usage Maximum (3)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x91, 0x02, // Output(Data, Variable, Absolute)
0x95, 0x05, // Report Count (5)
0x75, 0x01, // Report Size (1)
0x91, 0x01, // Output(Constant)
0x95, 0x06, // Report Count(6)
0x75, 0x08, // Report Size (8)
0x15, 0x00, // Logical Minimum (0)
0x26, 0xE7, 0x00, // Logical Maximum (231)
0x05, 0x07, // Usage Page (Keyboard/Keypad Keys)
0x19, 0x00, // Usage Minimum (0)
0x29, 0xE7, // Usage Maximum (231)
0x81, 0x00, // Input(Data, Variable, Absolute)
0xC0 //End Collection
}; //report len = 64 bytes
static unsigned char code mouse_report[] = {
/////////////////////////////////////////////////////////////////////
0x05, 0x01, //Usage page (Generic Desktop Control)
0x09, 0x02, //Uasge (Mouse)
0xA1, 0x01, //Collection (Application)
0x85, 0x01, // Report ID (1)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x03, // Usage Maximum (3)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input(Data, Variable, Absolute)
0x95, 0x01, // Report Count(1)
0x75, 0x05, // Report Size (5)
0x81, 0x01, // Input(Constant)
0x05, 0x01, // Usage Page (Generic Desktop Control)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x09, 0x38, // Usage (Wheel)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7f, // Logical Maximum (127)
0x95, 0x03, // Report Count (3)
0x75, 0x08, // Report Size (8)
0x81, 0x06, // Input(Data, Variable, Relative)
0xC0, // End Collection
0xC0, //End Collection
/////////////////////////////////////////////////////////////////////
0x05, 0x01, //Usage Page (Generic Desktop Control)
0x09, 0x80, //Usage (Reserved)
0xA1, 0x01, //Collection (Application)
0x85, 0x02, // Report ID (2)
0x19, 0x81, // Usage Minimum (129)
0x29, 0x88, // Usage Maximum (136)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x08, // Report Count (8)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input(Data, Variable, Absolute)
0xC0, //End Collection
////////////////////////////////////////////////////////////////////
0x05, 0x0C, //Usage Page (Consumer)
0x09, 0x01, //Usage (Consumer Control)
0xA1, 0x01, //Collection (Application)
0x85, 0x03, // Report ID (3)
0x19, 0x00, // Usage Minimum (0)
0x2A, 0x3C, 0x02, // Usage Maximum (572)
0x15, 0x00, // Logical Minimum (0)
0x26, 0x3C, 0x02, // Logical Maximum (572)
0x75, 0x10, // Report Size (16)
0x95, 0x01, // Report Count (1)
0x81, 0x00, // Input(Data, Array, Absolute)
0xC0 //End Collection
}; //report len = 0x66 = 102
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -