This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to send arbitrary data using on_hid_rep_char_write()?

Hi,

I'm able to send arbitrary information to the host using generic HID descriptor (uses vendor defined page). There is no driver issue. I'm also able to connect to the bluetooth of host. But I'm not able to receive data from host. How do I change on_hid_rep_char_write() in order to receive data? 

In HID keyboard example, the OUTPUT_REPORT_BIT_MASK_CAPS_LOCK uses the default value in HID table. What if it was an arbitrary value? So instead of caps lock should I keep polling for a value from host (open source HID API) and then may be light an led? 

Please to not divert me to HID keyboard & mouse examples! I need some concrete advise/help beyond those examples.

Parents Reply Children
  • Hello,

    Not sure whether I actually understand the question, but the characteristics that receive the caps lock information is the one marked in yellow here:

    BR,

    Edvin

  • Hey Edvin, 

    How did you do this?I have 2 nrf52832 DKs. I connect one to nrfconnect. I flash keyboard example on another board. Then I pair to 'Nordic_Keyboard' BLE device using nrfConnect. The reports are showing the error "Write operation failed: BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION (0x0105)"

  • Hello,

    What SDK version do you use? I don't think it should matter, but I haven't tested this example on all versions.

    I know that some of the characteristics require pairing (Note that "pairing" is not the same as "connecting")

    If you get insufficient authentication, you are trying to write to the wrong characteristic. It should be the third one from the top under "Human Interface Device".

    However, to see most of the characteristics, you need to pair. Just press the small settings icon in the top right corner of "Nordic_Keyboard", and press "Pair...", and click "Pair"(blue button), then you should be able to use the rest of the characteristics. If you also tick of for "Perform bonding", it will store the pairing information, so that you don't need to do the pairing every time.

    Best regards,

    Edvin

  • Hi Edvin,

    It works!! Thank you so much. Can you help me with 64-bit data? The highlighted values are being sent by me. They are just numbers. What are the other values being appended in input report? 

    Below is the log for output report for hid keyboard example. So here values are getting left shifted.

  • This is the HID protocol. I don't know what all of the different fields are used for, but you don't need to know that if you use the SDK. See how the example is set up, and how to send different key-presses.

    Best regards,

    Edvin

Related