HID keyboard - how to send Windows GUI key

Hi guys. May I ask some questions for ble_app_hids_keyboard_pca10056_s113 project from 17.1.0 nRF5 SDK:

 How to implement Ctrl-C for HID keyboard 

Similar to this thread, I was able to send [Windows + key] hotkeys, like Windows + R = "RUN" box.

As explained in the INFO center https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/ble_sdk_app_hids_keyboard.html

"The format used for keyboard reports is the following byte array:

[modifier, reserved, Key1, Key2, Key3, Key4, Key6, Key7]"

Sending "Windows + R" is byte array = [Modifier = 0x08, 0x00, Key1 = 0x15 (R), 0x00, 0x00, 0x00, 0x00, 0x00]

 Windows / GUI key picture

The problem is when I send Left GUI key 0xE3 or Right GUI key 0xE7, Windows doesn't respond.

EX: send [0x00, 0x00, Key1 = 0xE3 (Left GUI), 0x00, 0x00, 0x00, 0x00, 0x00] and send key release

May I ask your help how to send the Windows key using the nRF52 keyboard example? If the HID report map needs to change, let me know.

Thank you for your help!

Parents
  • Hi,

    Could you try e.g. 0x08 as the left GUI modifier key instead of 0xE3

      APP_USBD_HID_KBD_MODIFIER_NONE = 0x00,
      APP_USBD_HID_KBD_MODIFIER_LEFT_CTRL = 0x01,
      APP_USBD_HID_KBD_MODIFIER_LEFT_SHIFT = 0x02,
      APP_USBD_HID_KBD_MODIFIER_LEFT_ALT = 0x04,
      APP_USBD_HID_KBD_MODIFIER_LEFT_UI = 0x08,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_CTRL = 0x10,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_ALT = 0x40,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_UI = 0x80

Reply
  • Hi,

    Could you try e.g. 0x08 as the left GUI modifier key instead of 0xE3

      APP_USBD_HID_KBD_MODIFIER_NONE = 0x00,
      APP_USBD_HID_KBD_MODIFIER_LEFT_CTRL = 0x01,
      APP_USBD_HID_KBD_MODIFIER_LEFT_SHIFT = 0x02,
      APP_USBD_HID_KBD_MODIFIER_LEFT_ALT = 0x04,
      APP_USBD_HID_KBD_MODIFIER_LEFT_UI = 0x08,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_CTRL = 0x10,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_SHIFT = 0x20,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_ALT = 0x40,
      APP_USBD_HID_KBD_MODIFIER_RIGHT_UI = 0x80

Children
  • Hi Sigurd. Do you mean send

    [Modifier = 0x08, 0x00, Key1 = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]

    ? I tried but this doesn't work as well.

    Testing the Windows hotkey (Modifier 0x08 + Key1) is working though.

    What is the correct data format to "press the Windows key" to see the "Windows Start Menu"?

    Thank you for your help!

  • Matthew K said:
    What is the correct data format to "press the Windows key" to see the "Windows Start Menu"?

    If you are not "modifying" anything, how about 0x00,0x00,0xE3 ?

  • Hi Sigurd. As mentioned in the first thread,

    The problem is when I send Left GUI key 0xE3 or Right GUI key 0xE7, Windows doesn't respond.

    Key press: 00 00 E3 00 00 00 00 00

    Release: 00 00 00 00 00 00 00 00

    I tried this but Windows didn't show the start menu.

    This start menu is NOT showing. Is there something I'm missing? Thank you for your help!

  • Hi,

    I got 0xE3 and 0xE7 working, but I needed to change the HID report map to allow this. i.e. Logical Maximum(101) / Usage Maximum (101) changed from 0x65 to 0xe7

        static uint8_t                     report_map_data[] =
        {
            0x05, 0x01,       // Usage Page (Generic Desktop)
            0x09, 0x06,       // Usage (Keyboard)
            0xA1, 0x01,       // Collection (Application)
            0x05, 0x07,       // Usage Page (Key Codes)
            0x19, 0xe0,       // Usage Minimum (224)
            0x29, 0xe7,       // Usage Maximum (231)
            0x15, 0x00,       // Logical Minimum (0)
            0x25, 0x01,       // Logical Maximum (1)
            0x75, 0x01,       // Report Size (1)
            0x95, 0x08,       // Report Count (8)
            0x81, 0x02,       // Input (Data, Variable, Absolute)
    
            0x95, 0x01,       // Report Count (1)
            0x75, 0x08,       // Report Size (8)
            0x81, 0x01,       // Input (Constant) reserved byte(1)
    
            0x95, 0x05,       // Report Count (5)
            0x75, 0x01,       // Report Size (1)
            0x05, 0x08,       // Usage Page (Page# for LEDs)
            0x19, 0x01,       // Usage Minimum (1)
            0x29, 0x05,       // Usage Maximum (5)
            0x91, 0x02,       // Output (Data, Variable, Absolute), Led report
            0x95, 0x01,       // Report Count (1)
            0x75, 0x03,       // Report Size (3)
            0x91, 0x01,       // Output (Data, Variable, Absolute), Led report padding
    
            0x95, 0x06,       // Report Count (6)
            0x75, 0x08,       // Report Size (8)
            0x15, 0x00,       // Logical Minimum (0)
            0x25, 0xe7,       // Logical Maximum (101) // changed from 0x65 to 0xe7
            0x05, 0x07,       // Usage Page (Key codes)
            0x19, 0x00,       // Usage Minimum (0)
            0x29, 0xe7,       // Usage Maximum (101) // changed from 0x65 to 0xe7
            0x81, 0x00,       // Input (Data, Array) Key array(6 bytes)
    
            0x09, 0x05,       // Usage (Vendor Defined)
            0x15, 0x00,       // Logical Minimum (0)
            0x26, 0xFF, 0x00, // Logical Maximum (255)
            0x75, 0x08,       // Report Size (8 bit)
            0x95, 0x02,       // Report Count (2)
            0xB1, 0x02,       // Feature (Data, Variable, Absolute)
    
            0xC0              // End Collection (Application)
        };

  • Thank you so much Sigurd! Let's close this and have a great day!

Related