Microchip
直播中

杨晓健

7年用户 176经验值
私信 关注
[问答]

HID报告ID添加后操纵杆就无法枚举

和声2.03BMPLAB 3.61cc32 1.43i有一个操纵杆HID,它工作良好,在PC机驱动控制上显示正确-两个按钮都能正常工作。一旦我添加了一个报告ID(准备添加另一个输出报告),操纵杆就无法枚举。X01,//USAGE页面(通用桌面)0x09,0/04,/使用(操纵杆)0xA1,0x01,//Cube(/Application)//0x85,0x01,//报告ID(1)/ /添加,这导致按钮不能与PC驱动程序0x09,0x04,/ /使用(操纵杆)0xa1,0x00,//集合(物理)0x85,0x01,/ /报告ID(1)/ /添加此按钮导致按钮不能与PC驱动程序0x05、0x09、//UsAGEPGE(按钮)0x19、0x01、/使用最小值(Button 1)0x29、0x02、/使用最大值(按钮2)0x15、0x00、/逻辑最小值(0)0x25、0x01、/逻辑最大值(1)0x95、0x08、/或报告计数(8)仅使用0x75为2。,0x01,/ /报告大小(1)0x81a,0x02,//输入(数据,瓦尔河,ABS)0xC0,/ /结束收集(物理)0xC0,/ /结束收集(应用)};

以上来自于百度翻译


      以下为原文

    HARMony 2.03b
MPLAB 3.61
CC32 1.43

I have a joystick HID that works fine and shows up correctly on the PC driver control - both buttons function correctly.
As soon as I add a Report ID (preparatory to adding another report for output) the Joystick fails to enumerate.


const uint8_t hid_rpt0[] =
{
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (JoyStick)
0xA1, 0x01, // Collection (Application)
// 0x85, 0x01, // Report ID (1) //adding this causes the buttons to not work with the PC driver
0x09, 0x04, // USAGE (Joystick)
0xA1, 0x00, // Collection (Physical)
0x85, 0x01, // Report ID (1) //adding this causes the buttons to not work with the PC driver
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // Usage Minimum (Button1)
0x29, 0x02, // Usage Maximum (Button 2)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x08, // Report Count (8) only 2 used
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data,Var,Abs)
0xC0, // End Collection (Physical)
0xC0, // End Collection (Application)
};

回帖(8)

贾绰

2019-2-27 15:04:19
在报表描述符中添加报表ID时,还需要确保数据第一个字节(数据(0))中的中断具有报告ID。实际数据应该从现在的第二字节开始。如果您想在这个操纵杆报表描述符中添加另一个输出报告,则不需要添加报表。ID.请检查标准USB键盘在没有报告ID的情况下有两个输入和输出报告。如果需要进一步的信息,请告诉我。

以上来自于百度翻译


      以下为原文

    When you add a Report ID in the Report Descriptor you also need to make sure that
Interrupt IN data's first byte (data[0]) has the Report ID. The actual data should start from the 2nd byte now.
 
If you want to add another OUTPUT report in this Joystick Report Descriptor, you do not need to add Report ID. Please check how standard USB Keyboards have both INPUT and OUTPUT Reports without a Report ID present.
 
Please let me know if you need any further information.
举报

李昕一

2019-2-27 15:19:07
谢谢。这就解决了最初的问题。现在我试图添加一个输出报告,枚举失败。我假设它是简单的…0x05,0x09,0/0x04,0/04,//用法(操纵杆)0xa1,0x01,//收藏(应用)0x09,0x04,//使用(操纵杆)0xa1,0x00,//集合(物理)0x85,0x01,//报告ID(1)0x05,0x09,//使用页(按钮)0x19,0x01,//US。年龄最小(Button 1)0x29,0x02,/使用最大值(按钮2)0x15,0x00,//逻辑最小值(0)0x25,0x01,/逻辑最大值(1)0x95,0x08,/ /报告计数(8)仅使用0x75,0x01,/ /报告大小(1)0x81a,0x02,//输入(数据,瓦尔河,ABS)0xC0,/ /结束收集(物理)/添加代码低于0x06,0x00,0xFF,//Usage页(厂商定义页1)0x09,0x01,//用法(供应商使用率)0xa1,0x02,//集合(逻辑)0x85,0x02,/ /报告ID(2)0x15,0x00,/逻辑最小值(0)0x25,0x01,/逻辑最大值(1)0x75,0x01,/报告大小(1)0x95,0x01,/报告计数(8)0x91,0x02,//输出(数据,瓦尔河,ABS)0xC0,/ /结束收集(逻辑)0xC0,/ /结束收集(应用)

以上来自于百度翻译


      以下为原文

    Thanks. That fixed the initial problem. Now I'm trying to add an output report and enumeration fails. I assume it's something simple...
 
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (JoyStick)
0xA1, 0x01, // Collection (Application)
0x09, 0x04, // USAGE (Joystick)
0xA1, 0x00, // Collection (Physical)
0x85, 0x01, // Report ID (1)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // Usage Minimum (Button1)
0x29, 0x02, // Usage Maximum (Button 2)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x08, // Report Count (8) only 2 used
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data,Var,Abs)
0xC0, // End Collection (Physical)
 
//Added code below 
0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xA1, 0x02, // Collection (Logical)
0x85, 0x02, // Report ID (2)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (8)
0x91, 0x02, // Output (Data,Var,Abs)
0xC0, // End Collection (Logical)

0xC0, // End Collection (Application)
举报

贾绰

2019-2-27 15:25:24
0x05,0x09,0x09,0x04,//使用(操纵杆)0xa1,0x01,//集合(应用)0x09,0x04,/ /使用(操纵杆)0xa1,0x00,//集合(物理)0x85,0x01,/ /报告ID(1)0x05,0x09,//使用页(按钮)0x19,0x01,/ /使用最小值(Button 1)0x29,0x02,//使用最大值(按钮2)0x15、0x00、/或逻辑最小值(0)0x25、0x01、/逻辑最大值(1)0x95、0x08、/或报告计数(8)仅使用0x75、0x01、/或报告大小(1)0x81a、0x02、/(输入、数据、瓦尔河、ABS)0xC0、/ /结束收集(物理)0xC0、/结束收集(应用)//新添加//AD在0x06、0x00、0xFF、/Usage页面(厂商定义页1)0x09、0x01、/使用(供应商使用率1)0xa1、0x02、//集合(逻辑)0x85、0x02、/或报告ID(2)0x15、0x00、/或逻辑最小值(0)0x25、0x01、/逻辑最大值(1)0x75、0x01、/或报告大小(1)0x95、0x01、/或报告Cou.NT(8)0x91,0x02,//Outlook(数据,瓦尔河,ABS)0xC0,//结束收集(逻辑)//0xC0,/ /结束收集(应用程序)/删除此Link,请您尝试使用该报告描述符并让我知道您的观察。

以上来自于百度翻译


      以下为原文

    0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (JoyStick)
0xA1, 0x01, // Collection (Application)
0x09, 0x04, // USAGE (Joystick)
0xA1, 0x00, // Collection (Physical)
0x85, 0x01, // Report ID (1)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // Usage Minimum (Button1)
0x29, 0x02, // Usage Maximum (Button 2)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x08, // Report Count (8) only 2 used
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input (Data,Var,Abs)
0xC0, // End Collection (Physical)
0xC0, // End Collection (Application) //Newly Added
 
//Added code below 
0x06, 0x00, 0xFF, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xA1, 0x02, // Collection (Logical)
0x85, 0x02, // Report ID (2)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x75, 0x01, // Report Size (1)
0x95, 0x01, // Report Count (8)
0x91, 0x02, // Output (Data,Var,Abs)
0xC0, // End Collection (Logical)

// 0xC0, // End Collection (Application) // Removed this line
 
Could you please try with this report descriptor and let me know your observation.
举报

杨艳

2019-2-27 15:40:11
我已经尝试过了。原来0x95,0x01上的一个打印错误应该是0x95/0x08。眼睛一直在阅读评论而不是代码。现在列举并没有你的建议。不幸的是,当按下时操纵杆按钮不会被激活。:

以上来自于百度翻译


      以下为原文

    I tried that already. 
Turns out a typo on 0x95,0x01 should be 0x95,0x08. Eyes kept reading the comment not the code.
 
Now enumerates with and without your suggestion.
Unfortunately now the joystick buttons don't activate when pressed. :-(
举报

更多回帖

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