我们可以看一下MS定义的新的input report,简单的来说是通过AC Pan usage 来代表横向滚轮。
Input Report (Non-Boot) | ||||||||
Input | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
Byte 0 | Report ID (0x01) | |||||||
Byte 1 | 0 | Forward BT | Bback BT | Middle BT | Right BT | Left BT | ||
Byte 2 | X | |||||||
Byte 3 | Y | |||||||
Byte 4 | Wheel | |||||||
Byte 5 | AC Pan |
MS同时给出了collection的嵌套结构
Mouse Application Collection
Mouse Logical Collection
Pointer Physical Collection
Buttons (Input Report 0x01)
X (Input Report 0x01)
Y (Input Report 0x01)
Logical Collection
Resolution Multiplier (Feature Report 0x02)
Wheel (Input Report 0x01)
End Logical Collection
Logical Collection
Resolution Multiplier (Feature Report 0x02)
AC Pan (Input Report 0x01)
End Logical Collection
End Physical Collection
End Logical Collection
End Application Collection
// ------------------------------ Horizontal wheel res multiplier
0x09, 0x48, // USAGE (Resolution Multiplier)
0xb4, // POP
0xb1, 0x02, // FEATURE (Data,Var,Abs)
// ------------------------------ Horizontal wheel
0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
0x0a, 0x38, 0x02, // USAGE (AC Pan)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7f, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x06, // INPUT (Data,Var,Rel)
0x09, 0x48, // USAGE (Resolution Multiplier)
0xb4, // POP
0xb1, 0x02, // FEATURE (Data,Var,Abs)
// ------------------------------ Horizontal wheel
0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
0x0a, 0x38, 0x02, // USAGE (AC Pan)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7f, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x06, // INPUT (Data,Var,Rel)
需要注意的是在XP下如果保持上述声明可能会造成比较奇怪的效果,建议在代码中加以区分。
没有评论:
发表评论