完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
寻找一些帮助获得报告ID到我的USB HID键盘的目的是添加媒体密钥。我一定会更新这个帖子,当我的问题已经解决。对不起,这有点长,但我想证明我已经尝试了很多东西。从MLA 2017 03-06开始。在修正FixDead地址后,可以(最后)发送键盘键到记事本。好的。现在,我想通过添加另一个TLD并引入报告ID来发送媒体控制键。这使我的描述符如下:我已经添加到KiBooDr.IpPuthRePosits中,然后我不确定是否应该改变:OR,并且我有SEtiN MyAppHykey BoBOARD任务,如果(HIDTXHANDLL繁忙…代码。但是,据我所知,键盘消息现在是9字节,限制为8字节,因此较低级别需要将其拆分为两个消息。我已经做了很多谷歌,Requneo和帖子从其他人,到目前为止,什么也没有。目前,它似乎无法适当地枚举。我还尝试修改原来的示例——删除保留字节并将报告ID添加到KEYBOADARIN PUTPUX报表的开始处,更新描述符如下:然后枚举,但不发送按键。
以上来自于百度翻译 以下为原文 Looking for some help getting report IDs into my USB HID keyboard with the aim of adding media keys. I will be sure to update this post when the issue I am having is resolved. Sorry, it's a bit long but I wanted to show that I've tried a lot of things. Started with MLA 2017-03-06. After correcting fixed_address_descriptor.h #define KEYBOARD_INPUT_REPORT_DATA_BUFFER_ADDRESS_TAG @0x500 #define KEYBOARD_OUTPUT_REPORT_DATA_BUFFER_ADDRESS_TAG @0x508 I can (finally) send keyboard keys to notepad. Good. Now, what I want is to send media control keys by adding another TLD and introduce report IDs. This leaves my descriptor as follows: //Class specific descriptor - HID Keyboard + media (size 100)) const struct{uint8_t report[HID_RPT01_SIZE];}hid_rpt01={ { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x06, // USAGE (Keyboard) 0xa1, 0x01, // COLLECTION (Application) 0x85, 0x01, // Report ID 0x05, 0x07, // USAGE_PAGE (Keyboard) 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x75, 0x01, // REPORT_SIZE (1) 0x95, 0x08, // REPORT_COUNT (8) 0x81, 0x02, // INPUT (Data,Var,Abs) 0x95, 0x01, // REPORT_COUNT (1) 0x75, 0x08, // REPORT_SIZE (8) 0x81, 0x03, // INPUT (Cnst,Var,Abs) 0x95, 0x05, // REPORT_COUNT (5) 0x75, 0x01, // REPORT_SIZE (1) 0x05, 0x08, // USAGE_PAGE (LEDs) 0x19, 0x01, // USAGE_MINIMUM (Num Lock) 0x29, 0x05, // USAGE_MAXIMUM (Kana) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x95, 0x01, // REPORT_COUNT (1) 0x75, 0x03, // REPORT_SIZE (3) 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) 0x95, 0x06, // REPORT_COUNT (6) 0x75, 0x08, // REPORT_SIZE (8) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x65, // LOGICAL_MAXIMUM (101) 0x05, 0x07, // USAGE_PAGE (Keyboard) 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) 0x81, 0x00, // INPUT (Data,Ary,Abs) 0xc0, // End Collection 0x05, 0x0C, //* Usage Page (Consumer Devices) 0x09, 0x01, //* Usage (Consumer Control) 0xA1, 0x01, //* Collection (Application) 0x85, 0x02, //* Report ID=2 0x05, 0x0C, //* Usage Page (Consumer Devices) 0x15, 0x00, //* Logical Minimum (0) 0x25, 0x01, //* Logical Maximum (1) 0x75, 0x01, //* Report Size (1) 0x95, 0x07, //* Report Count (7) 0x09, 0xe2, // USAGE (Mute) 0x01 0x09, 0xe9, // USAGE (Volume Up) 0x02 0x09, 0xea, // USAGE (Volume Down) 0x03 0x09, 0xcd, // USAGE (Play/Pause) 0x04 0x09, 0xb7, // USAGE (Stop) 0x05 0x09, 0xb6, // USAGE (Scan Previous Track) 0x06 0x09, 0xb5, // USAGE (Scan Next Track) 0x07 0x81, 0x03, // INPUT (Cnst,Var,Abs) padding, 1 bit 0xC0} /// End Collection }; I have added uint8_t reportId; into KEYBOARD_INPUT_REPORT Then I changed #define HID_RPT01_SIZE 100 Not sure if I should be changing: #define HID_INT_IN_EP_SIZE 8 or /* Endpoint Descriptor */ 0x07,/*sizeof(USB_EP_DSC)*/ USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor HID_EP | _EP_IN, //EndpointAddress _INTERRUPT, //Attributes DESC_CONFIG_WORD(8), //size 0x01, And I have set inputReport.reportId = 1; in my APP_KeyboardTasks, if(HIDTxHandleBusy... code. But as far as I can tell the keyboard message is now 9 bytes, with a limit of 8 bytes so the lower level needs to split it into two messages. I've done a lot of googling, read Tsuneo and posts from others and so far nothing. Currently it appears to fail to enumerate properly. I've also tried just modifying the original example - removing the reserved byte and adding the report id into the start of KEYBOARD_INPUT_REPORT, updating the descriptor as follows: //Class specific descriptor - HID Keyboard with consumer media keyboard const struct{uint8_t report[HID_RPT01_SIZE];}hid_rpt01={ { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x06, // USAGE (Keyboard) 0xa1, 0x01, // COLLECTION (Application) 0xa1, 0x00, // collection physical 0x85, 0x01, // Report ID 0x05, 0x07, // USAGE_PAGE (Keyboard) 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x01, // LOGICAL_MAXIMUM (1) 0x75, 0x01, // REPORT_SIZE (1) 0x95, 0x08, // REPORT_COUNT (8) 0x81, 0x02, // INPUT (Data,Var,Abs) //0x95, 0x01, // REPORT_COUNT (1) //0x75, 0x08, // REPORT_SIZE (8) //0x81, 0x03, // INPUT (Cnst,Var,Abs) 0x95, 0x05, // REPORT_COUNT (5) 0x75, 0x01, // REPORT_SIZE (1) 0x05, 0x08, // USAGE_PAGE (LEDs) 0x19, 0x01, // USAGE_MINIMUM (Num Lock) 0x29, 0x05, // USAGE_MAXIMUM (Kana) 0x91, 0x02, // OUTPUT (Data,Var,Abs) 0x95, 0x01, // REPORT_COUNT (1) 0x75, 0x03, // REPORT_SIZE (3) 0x91, 0x03, // OUTPUT (Cnst,Var,Abs) 0x95, 0x06, // REPORT_COUNT (6) 0x75, 0x08, // REPORT_SIZE (8) 0x15, 0x00, // LOGICAL_MINIMUM (0) 0x25, 0x65, // LOGICAL_MAXIMUM (101) 0x05, 0x07, // USAGE_PAGE (Keyboard) 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) 0x81, 0x00, // INPUT (Data,Ary,Abs) 0xc0, //end phy 0xc0} // End Collection }; Then it enumerates but won't send keypresses. |
|
相关推荐
4个回答
|
|
您好,在报告描述符的末尾,这两行是必需的。为了更好地声明一个消费设备,请参考这个PAS.HTTP://www. McCHIP.COM/FUMMS/FUNDSPE/44 1405,IN端点的“大小”字段(WMax PACKETSIZE)设置为9。然后,您的固件可以在SI中发送9个字节。在枚举之后,主机返回一个输出报告(用于LED)。报告ID也应用到输出报告:现在输出报告计数两个字节,而不是一个字节。原始固件只传递一个字节缓冲器到USB引擎。两个字节的输出报告会导致缓冲区溢出错误,导致引擎挂起。由于这个原因,您的固件不能在这个错误之后发送任何输入报告。我将修改的HIDIG键盘(v2017y03y06AppUSB设备)附加到这个帖子上。在这个修改中检查了(旧的)PICDEM FSUB板(PIC16F450),-报告描述符:键盘TLC+消费者控制(Media)TLC。他的报告工作了,许多其他的代码行都被改变了。键盘部分像原来一样工作,但是媒体密钥部分还没有实现。你可以在主环中添加AppHyMediaKeTasks-()之后,在主循环中发送媒体密钥。AppMediaKeTasks-()的内容几乎与AppyKiBoA相同。rdtasks-(),除了-AppMyIdKeAtTasks-()之外,使用它自己的状态变量:键盘:WaTiGeFieldPosiv.MeaAcKe.WaTiGeFieldFox等-AppMIdiaKEY TASKSK()在“MealRealPoT”缓冲区上工作,而不是“输入报告”缓冲区-AppMIdiaKEY TASKSK()看到另一个按钮(修改ButoNo.UBBDeice要发送到EP中的公共,这个行不应该是变线410:如果(HIDTxHandleBusy(键盘,LASTIN传输)=FALSE),这条线只替换缓冲器命名空间472:键盘。将AppIKEngEndiItId()例程复制到AppMIdiaKeInIt()中,以初始化上面的状态变量。将AppMIdiaKiEnIt()添加到“CaseEngIdBase::Zuneo”中
以上来自于百度翻译 以下为原文 Hi swanny, At the end of your report descriptor, these two lines are required. 0x09, 0xb5, // USAGE (Scan Next Track) 0x07 0x81, 0x06, // INPUT (Data,Var,Rel) // <---- 0x95, 0x01, // REPORT_COUNT (1) // <---- 0x81, 0x03, // INPUT (Cnst,Var,Abs) padding, 1 bit 0xC0} /// End Collection For better declaration of a consumer device, refer to this post. http://www.microchip.com/forums/FindPost/441405 The "size" field (wMaxPacketSize) of the IN endpoint is set to 9. And then, your firmware can send 9 bytes in single packet. /* Endpoint Descriptor */ 0x07,/*sizeof(USB_EP_DSC)*/ USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor HID_EP | _EP_IN, //EndpointAddress _INTERRUPT, //Attributes DESC_CONFIG_WORD(9), //size // <---- 0x01, The host returns an output report (for LEDs), just after enumeration. The report ID is applied to the output report, too: now the output report counts two bytes, not in one byte. The original firmware passes just one byte buffer to the USB engine. The two bytes output report causes buffer overflow error, which results in engine hanging up. In this reason, your firmware can't send any input report after this error. I attached modified hid_keyboard (v2017_03_06appsu***device) to this post. Checked on a (old) PICDEM FSUSB board (PIC16F4550) In this modification, - Report descriptor: keyboard TLC + consumer control (media) TLC - To make this report work, many other code lines are changed. The keyboard part works like the original. But media key part is not implemented yet. You may add APP_MediaKeyTasks() just after APP_KeyboardTasks() in the main loop to send media keys. int main(void) { ... while(1) { ... APP_KeyboardTasks(); APP_MediaKeyTasks(); // <---- }//end while The contents of APP_MediaKeyTasks() are almost same as APP_KeyboardTasks(), except for - APP_MediaKeyTasks() uses its own state variables: keyboard.waitingForRelease --> mediaKey.waitingForRelease etc. - APP_MediaKeyTasks() works on "mediaReport" buffer instead of "inputReport" buffer - APP_MediaKeyTasks() sees another push button (modify BUTTON_USB_DEVICE_HID_KEYBOARD_KEY) - To send to the common IN EP, this line should not be changed line 410: if(HIDTxHandleBusy(keyboard.lastINTransmission) == false) Also, this line replaces just the buffer name line 472: keyboard.lastINTransmission = HIDTxPacket(HID_EP, (uint8_t*)&mediaReport, sizeof(mediaReport)); - Copy APP_KeyboardInit() routine into APP_MediaKeyInit() to initialize above state variables. Add APP_MediaKeyInit() into "case EVENT_CONFIGURED:" u***_events.c bool USER_USB_CALLBACK_EVENT_HANDLER(USB_EVENT event, void *pdata, uint16_t size) { switch((int)event) { ... case EVENT_CONFIGURED: /* When the device is configured, we can (re)initialize the keyboard * demo code. */ APP_KeyboardInit(); APP_MediaKeyInit(); // <--- break; Tsuneo Attachment(s) ztest_hid_kb_media..s_mla2017_03_06.zip (37.58 KB) - downloaded 74 times |
|
|
|
|
|
|
|
谢谢,谢谢你的回复。你所说的是有意义的(当然,输出报告也需要添加一个报告ID)。感谢添加媒体关键功能的扩展技巧。还没有弄清楚代码是如何看起来的(因为第一个mod就是我被卡住的地方),但是我想我可能会在一些事情上混日子。当我得到机会并汇报时,我会测试它。
以上来自于百度翻译 以下为原文 Hi Tsuneo, Thanks for your response. What you've said makes sense (of course the OUTPUT report would also need to have a report id added). Thanks for the extended tips on adding the media key functionality. Hadn't got as far as figuring out how the code would look yet (as the first mod was where I got stuck) but thought I might shuffle around things a little. I will test it out when I get a chance and report back. Cheers, Swanny. |
|
|
|
成功!昨晚晚些时候,我得到了媒体按键,键盘部分有点坏(每次发送多个按键),但是我的播放/暂停按钮工作正常。不要认为这是主要的。当我得到正确的工作时,它将发布详细的更新信息。
以上来自于百度翻译 以下为原文 Success! Late last night I got the media key working, the keyboard part was a bit broken (it was sending multiple keystrokes at a time) but my play/pause button was working well. Don't think that is major. Will post another update with details when I get it working properly. |
|
|
|
只有小组成员才能发言,加入小组>>
5140 浏览 9 评论
1988 浏览 8 评论
1917 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3159 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2215 浏览 5 评论
708浏览 1评论
598浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
480浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
609浏览 0评论
505浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-8 21:29 , Processed in 1.175649 second(s), Total 83, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号