WCH沁恒单片机
直播中

abdkjshd

8年用户 1162经验值
擅长:可编程逻辑
私信 关注
[问答]

CH554接PC时,hid_report长度超128字节就无法注册是为什么?

你好,请问ch554对hid_report长度支持最大是多少?我这边测试时超128 byte时pc就识别不了,如下所示:
      一.  以下在电脑上注册时,键盘的hid_report是59 byte, 在pc上可正常注册且键盘能正常使用;但鼠标的hid_report 是142 byte, 在pc上注册不了,在pc的设置管理器那会看到一个黄色的叹号,提示该设置无法启动。
      二.  我改用hid_report为79 byte的鼠标时, 是可以正常使用的。不啥为啥超过128 byte就不行。
      麻烦帮看下是什么问题,谢谢!


1. 设置描述符:
UINT8C DevDesc[18] =
{
0x12,0x01,0x10,0x01,0x00,0x00,0x00,0x08,
0x8A,0x24,0x67,0x83,0x00,0x01,0x01,0x02,
0x00,0x01  
}



2. 配置描述符:
UINT8 CfgDesc[] =
{
0x09,0x02,0x3B,0x00,0x02,0x01,0x00,0xA0,0x19,
0x09,0x04,0x00,0x00,0x01,0x03,0x01,0x02,0x00,
0x09,0x21,0x11,0x01,0x21,0x01,0x22,0x8E,0x00,
0x07,0x05,0x82,0x03,0x08,0x00,0x04,        
0x09,0x04,0x01,0x00,0x01,0x03,0x01,0x01,0x00,
0x09,0x21,0x11,0x01,0x21,0x01,0x22,0x3B,0x00,
0x07,0x05,0x81,0x03,0x08,0x00,0x0A
}


3.  hid_report  --鼠标
UINT8 RepDesc_0[]=   //142 byte
{
0x05,0x01,0x09,0x02,0xA1,0x01,0x85,0x01,
0x09,0x01,0xA1,0x00,0x05,0x09,0x19,0x01,
0x29,0x05,0x15,0x00,0x25,0x01,0x95,0x05,
0x75,0x01,0x81,0x02,0x95,0x01,0x75,0x03,
0x81,0x01,0x05,0x01,0x09,0x30,0x09,0x31,
0x15,0x81,0x25,0x7F,0x75,0x08,0x95,0x02,
0x81,0x06,0x09,0x38,0x15,0x81,0x25,0x7F,
0x75,0x08,0x95,0x01,0x81,0x06,0xC0,0xC0,
0x05,0x0C,0x09,0x01,0xA1,0x01,0x85,0x03,
0x75,0x10,0x95,0x02,0x15,0x01,0x26,0x8C,
0x02,0x19,0x01,0x2A,0x8C,0x02,0x81,0x00,
0xC0,0x05,0x01,0x09,0x80,0xA1,0x01,0x85,
0x04,0x75,0x02,0x95,0x01,0x15,0x01,0x25,
0x03,0x09,0x82,0x09,0x81,0x09,0x83,0x81,
0x60,0x75,0x06,0x81,0x03,0xC0,0x05,0x01,
0x09,0x00,0xA1,0x01,0x85,0x05,0x06,0x00,
0xFF,0x09,0x01,0x15,0x81,0x25,0x7F,0x75,
0x08,0x95,0x07,0xB1,0x02,0xC0
}


4.  hid_report  --键盘
UINT8 RepDesc_1[ ]=   //59 byte
{
0x05,0x01,0x09,0x06,0xA1,0x01,0x05,0x07,
0x19,0xE0,0x29,0xE7,0x15,0x00,0x25,0x01,
0x95,0x08,0x75,0x01,0x81,0x02,0x81,0x03,
0x95,0x05,0x05,0x08,0x19,0x01,0x29,0x05,
0x91,0x02,0x95,0x01,0x75,0x03,0x91,0x01,
0x95,0x06,0x75,0x08,0x15,0x00,0x26,0xA4,
0x00,0x05,0x07,0x19,0x00,0x2A,0xA4,0x00,
0x81,0x00,0xC0
}


  
  

回帖(1)

刘润生

2022-6-27 11:09:38
示例代码里有个将传输长度限制在0X7F以下的判断,把那个删掉试试。之前好像遇到过这个问题
举报

更多回帖

发帖
×
20
完善资料,
赚取积分