You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/01/11 18:39:12 UTC

[mynewt-core] branch master updated: Fix wrong desc_hid_report

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 73be3f4  Fix wrong desc_hid_report
73be3f4 is described below

commit 73be3f4f4bff86885fefd7530499c75ff43d3cf1
Author: Chen Mulong <ch...@gmail.com>
AuthorDate: Mon Jan 11 00:30:38 2021 +0800

    Fix wrong desc_hid_report
    
    HID_REPORT_ID is needed when using TUD_HID_REPORT_DESC_KEYBOARD. By
    passing `(int_id, )` to the macro, the hid device can be recognized
    under Linux with an error message "unknown main item tag 0x0". The
    normal keys works fine surprisingly in this case but not the modifiers.
    Defining the report in this way would cause a Windows device failure
    with code 10.
    
    See "HID Report Descriptor Template" comments in `hid_device.h` for more
    information.
---
 hw/usb/tinyusb/std_descriptors/src/std_descriptors.c | 6 +++---
 hw/usb/tinyusb/std_descriptors/syscfg.yml            | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/usb/tinyusb/std_descriptors/src/std_descriptors.c b/hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
index e7d809f..4f00cba 100755
--- a/hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
+++ b/hw/usb/tinyusb/std_descriptors/src/std_descriptors.c
@@ -49,14 +49,14 @@
 #if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD) || MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
 const uint8_t desc_hid_report[] = {
 #if MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD)
-    TUD_HID_REPORT_DESC_KEYBOARD(MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD),),
+    TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(MYNEWT_VAL(USBD_HID_REPORT_ID_KEYBOARD))),
 #endif
 #if MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)
-    TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(REPORT_ID_MOUSE),)
+    TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(MYNEWT_VAL(USBD_HID_REPORT_ID_MOUSE)))
 #endif
 };
 #else
-#error Please specify keybaord and/or mouse report id
+#error Please specify keybaord and/or mouse report id with a non-zero value
 #endif
 
 /*
diff --git a/hw/usb/tinyusb/std_descriptors/syscfg.yml b/hw/usb/tinyusb/std_descriptors/syscfg.yml
index 8a80513..d557fc9 100644
--- a/hw/usb/tinyusb/std_descriptors/syscfg.yml
+++ b/hw/usb/tinyusb/std_descriptors/syscfg.yml
@@ -109,7 +109,7 @@ syscfg.defs:
         value:
 
     USBD_HID_REPORT_ID_KEYBOARD:
-        description: HID keyboard report ID
+        description: HID keyboard report ID. 0 Or empty to ommit the report.
         value:
     USBD_HID_CAPS_LOCK_LED_PIN:
         description: Caps Lock LED
@@ -124,7 +124,7 @@ syscfg.defs:
         description: Value to set to pin to turn led on
         value: 0
     USBD_HID_REPORT_ID_MOUSE:
-        description: HID keyboard report ID
+        description: HID keyboard report ID. 0 Or empty to ommit the report.
         value:
 
     USBD_BTH_EVENT_EP: