调用SDP Helper接口非常简单,基本上跟Sample Code差不多,只不过代码换成了Python编程。
#!/usr/bin/env python
import ctypes,os
hidd_report_desc = bytearray(
[
0x05, 0x01, # UsagePage GenericDesktop
0x09, 0x02, # Usage Mouse
0xA1, 0x01, # Collection Application
0x85, 0x01, # REPORT ID: 1
0x09, 0x01, # Usage Pointer
0xA1, 0x00, # Collection Physical
0x05, 0x09, # UsagePage Buttons
0x19, 0x01, # UsageMinimum 1
0x29, 0x03, # UsageMaximum 3
0x15, 0x00, # LogicalMinimum 0
0x25, 0x01, # LogicalMaximum 1
0x75, 0x01, # ReportSize 1
0x95, 0x03, # ReportCount 3
0x81, 0x02, # **Input data variable absolute
0x75, 0x05, # ReportSize 5
0x95, 0x01, # ReportCount 1
0x81, 0x01, # **InputConstant (padding)
0x05, 0x01, # UsagePage GenericDesktop
0x09, 0x30, # Usage X
0x09, 0x31, # Usage Y
0x09, 0x38, # Usage ScrollWheel
0x15, 0x81, # LogicalMinimum -127
0x25, 0x7F, # LogicalMaximum +127
0x75, 0x08, # ReportSize 8