HIDS_SUBSCRIBER_PIPELINE_SIZE

I'm using the nRF Desktop sample and I saw that it is sending two reports on mouse button/keyboard key press (not release). This seems to be because HIDS_SUBSCRIBER_PIPELINE_SIZE is defined as 2. The comment on this says:

/* To ensure that new report data is sent in every connection event, stack need to be fed with
 * two reports because we get information that submitted report was sent in a subsequent
 * Bluetooth LE connection event.
 */
#define HIDS_SUBSCRIBER_PIPELINE_SIZE 0x02

Please could you explain this further, as I don't understand why it needs to send 2 "press" reports (but only 1 release report)?

  • Hi,

    The pipeline is required e.g. to ensure that motion sensor is sampled once every BLE connection interval (motion sensor sampling is synchronized to sending data to HID host): 

    If the device is connected through Bluetooth LE or the device is connected through USB and USB Start of Frame (SOF) synchronization is enabled, the HID state module uses a pipeline that consists of two HID reports that it creates upon receiving the first motion_event. The HID state module submits two hid_report_event events. Sending the first event to the host triggers the motion sensor sample.

    For the Bluetooth connections, submitting hid_report_sent_event is delayed by one Bluetooth connection interval. Because of this delay, the HID Service module requires a pipeline of two sequential HID reports to make sure that data is sent on every connection event. Such a solution is necessary to achieve a high report rate. For USB Start of Frame (SOF) synchronization, the pipeline of two sequential HID reports is necessary to ensure that a USB peripheral can provide HID data on every USB poll.

    Ref: https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/applications/nrf_desktop/description.html#hid_mouse_report_handling

    HID keypress sampling is not synchronized to sending data over BLE, but once HID state receives button_event related to HID keyboard input report or HID mouse report, the report pipeline is generated too. Since buttons are reported in these HID reports as "state of currently pressed buttons", user might observe that button press is reported twice.

    Hope that helps,
    Kenneth

Related