使用官方的keyboard历程 添加了
0x05, 0x0c, // USAGE_PAGE (Consumer Devices)
0x09, 0x01, // USAGE (Consumer Control)
0xa1, 0x01, // COLLEC
tiON (Application)
0x85, 0x02, // REPORT_ID (2)
0x75, 0x08, /* Report Size (16), */
0x95, 0x01, /* Report Count (1), */
0x15, 0x01, /* Logical Minimum (1), */
0x26, 0x8C, 0x02, /* Logical Maximum (652), */
0x19, 0x01, /* Usage Minimum (Consumer Control), */
0x2A, 0x8C, 0x02, /* Usage Maximum (AC Send), */
0x81, 0x60, /* Input (No Preferred, Null State), */
0xC0, /* End Collection, */
如上map
buf[0]=0xE9; buf[1]=0;
调用
HidDev_Report( HID_RPT_ID_CONSUMER_IN, HID_REPORT_TYPE_INPUT,
HID_CONSUMER_IN_RPT_LEN, buf );
函数发送键值控制音量调节
#define HID_CONSUMER_VOLUME_UP 233 // 0xE9 - Volume Increment
#define HID_CONSUMER_VOLUME_DOWN 234 // 0xEA - Volume Decrement
测试发送如上键值在苹果
手机测试正常 安卓手机无反应不知哪里的原因 还请解答