Need help with combining mouse, keyboard and media into one HID.

Hello,
I have combine mouse with keyboard HID_12 and keyboard with media HID_23,
but not able to combine mouse with media and all 3 together!
Here are my HID_12  and HID_23:

HID_12  
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
0x09, 0x02, /* USAGE (Mouse) */
0xa1, 0x01, /* COLLECTION (Application) */
0x85, MOUSE_REPORT_ID, /* Report ID (1) */
0x09, 0x01, /* USAGE (Pointer) */
0xa1, 0x00, /* COLLECTION (Physical) */
0x05, 0x09, /* USAGE_PAGE (Button) */
0x19, 0x01, /* USAGE_MINIMUM (Button 1) */
0x29, 0x03, /* USAGE_MAXIMUM (Button 3) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
0x95, 0x03, /* REPORT_COUNT (3) */
0x75, 0x01, /* REPORT_SIZE (1) */
0x81, 0x02, /* INPUT (Data,Var,Abs) */
0x95, 0x01, /* REPORT_COUNT (1) */
0x75, 0x05, /* REPORT_SIZE (5) */
0x81, 0x03, /* INPUT (Cnst,Var,Abs) */
0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */
0x09, 0x30, /* USAGE (X) */
0x09, 0x31, /* USAGE (Y) */
0x09, 0x38, /* USAGE (Wheel) */
0x15, 0x81, /* LOGICAL_MINIMUM (-127) */
0x25, 0x7f, /* LOGICAL_MAXIMUM (127) */
0x75, 0x08, /* REPORT_SIZE (8) */
0x95, 0x03, /* REPORT_COUNT (3) */
0x81, 0x06, /* INPUT (Data,Var,Rel) */
0xc0, /* END_COLLECTION (Physical) */
0xc0, /* END_COLLECTION (Application) */

0x09, 0x06, /* USAGE (Keyboard) */
0xa1, 0x01, /* COLLECTION (Application) */
0x85, KEYBOARD_REPORT_ID, /* REPORT ID (0x02) */
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
0xa1, 0x01, /* COLLECTION (Application) */
0x95, 0x08, /* REPORT_COUNT (8) */
0x75, 0x08, /* REPORT_SIZE (8) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0xff, /* LOGICAL_MAXIMUM (255) */
0x19, 0x00, /* USAGE_MINIMUM (0) */
0x29, 0xff, /* USAGE_MAXIMUM (255) */
0x81, 0x00, /* INPUT (Data,Var,Abs) */
0xc0, /* END_COLLECTION (Application) */
0xc0, /* END_COLLECTION (Application) */

HID_23
0x05, 0x01, /* USAGE_PAGE (Generic Desktop)*/
0x09, 0x06, /* USAGE (Keyboard) */
0xa1, 0x01, /* COLLECTION (Application) */
0x85, KEYBOARD_REPORT_ID, /* REPORT ID (0x02) */
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
0xa1, 0x01, /* COLLECTION (Application) */
0x95, 0x08, /* REPORT_COUNT (8) */
0x75, 0x08, /* REPORT_SIZE (8) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0xff, /* LOGICAL_MAXIMUM (255) */
0x19, 0x00, /* USAGE_MINIMUM (0) */
0x29, 0xff, /* USAGE_MAXIMUM (255) */
0x81, 0x00, /* INPUT (Data,Var,Abs) */
0xc0, /* END_COLLECTION (Application) */
0xc0, /* END_COLLECTION (Application) */

0x05, 0x0c, // USAGE_PAGE (Consumer Devices) // 3 - OK - PC Volume Down
0x09, 0x01, // USAGE (Consumer Control)
0xa1, 0x01, /* COLLECTION (Application) */
0x05, 0x0c, /* USAGE_PAGE (Consumer) */
0x09, 0x01, /* USAGE (Consumer Control) */
0xa1, 0x01, /* COLLECTION (Application) */
0x85, MEDIA_REPORT_ID, /* REPORT ID (0x03) */
0x95, 0x02, /* REPORT_COUNT (2) */
0x75, 0x10, /* REPORT_SIZE (16) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x26, 0x9C, 0x02, /* LOGICAL_MAXIMUM (1) */
0x19, 0x00, /* USAGE_MINIMUM */
0x2A, 0x9C, 0x02, /* USAGE_MAXIMUM */
0x81, 0x00, /* INPUT (Data,Var,Abs) */
0xc0, /* END_COLLECTION (Application) */
0xc0, /* END_COLLECTION (Application) */

Parents Reply
  • Thank you Håkon Alseth for support.

    But now I have very impotent for me question:

    I have implemented ble HID Keyboard, Mouse and their Combo on STM32WB55 hardware.

    1. Now I have used HID Keyboard Report Descriptor from ble_app_hids_keyboard_pca10040_s132 project and used it in STM32 project. After making BLE connection device was installed without error.

    2. But after using HID Mouse Report Descriptor from ble_app_hids_mouse_pca10040_s132 project the same way in STM32 -  after making BLE connection device was installed with driver error.

    The question is: as BLE HID descriptor is not dependent on hardware - so how this can happens?

    Did anybody try ble_app_hids_mouse_pca10040_s132 project? 

Children
  • Hi,

     

    Did you follow what is stated here?

    Håkon Alseth said:

    If you take one of the ble_app_hids samples, lets say ble_app_hids_mouse, there is a main.c::hids_init function that maps each report to a given HID over GATT input, output, or feature report.

    Each new descriptor that you add will need to be mapped to the corresponding p_input_report[index] (or p_output_report) to ensure that it is populated in the GATT database.

     

    When you have any issues, please provide any log output from the nrf side and a detailed description on what occurs on the central side.

    When adding new addition to the descriptor, this must be handled accordingly.

     

    Kind regards,

    Håkon

  • Thank you,

    Yes, I understand that p_input_report and p_output_report should be mapped to HID report descriptor AFTER ble connection was made and drivers were installed based on HID report descriptor that was send first.

    So when I send only HID report descriptor there is driver error during driver installation and I did not send any p_input_report and p_output_report !

     

  • Hi,

     

    GS2 said:
    AFTER ble connection was made

    GATT must be populated prior to the connection being made.

     

    Please share your code so I can see what you've done. Specifically the ble_hids_init() function and your changes made to that function.

     

    Kind regards,

    Håkon

  • After establishing connection I send report descriptor:

    void HIDSAPP_Init(void) {
    tBleStatus result = BLE_STATUS_INVALID_PARAMS;


    result = HIDS_Update_Char(REPORT_MAP_CHAR_UUID, 0, 0,
    MOUSE_REPORT_SIZE,
    (uint8_t *)&report_mouse);

    that should initializes PC drivers installation and only after that by pressing buttons - different reports are send.

    And again - Did anybody try ble_app_hids_mouse_pca10040_s132 example with Windows 11 Pro that I am using?

  • GS2 said:

    void HIDSAPP_Init(void) {
    tBleStatus result = BLE_STATUS_INVALID_PARAMS;


    result = HIDS_Update_Char(REPORT_MAP_CHAR_UUID, 0, 0,
    MOUSE_REPORT_SIZE,
    (uint8_t *)&report_mouse);

    This is not code from the ble_apps_hids samples. Where did you get this from?

     

    Kind regards,

    Håkon

Related