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

Increasing number of bytes in HID descriptor

Hi,

I'm working on hid keyboard example. How can I check whether multiple bytes are received & transmitted after I increase the assigned no. of bytes in input/output report? From the code I understood that nrf device can send 64 bytes to host device. So how do I append bytes in one packet of 64 bytes when sending to host? How does it work from host side? Does nrf read 1 byte at a time sent from host?

Parents
  • So how do I append bytes in one packet of 64 bytes when sending to host?

     What do you mean by that? Do you want to increase the packet size so you can send more than 64 bytes?

  • I read somewhere that Windows machine accepts 64 bytes from BLE device. So accordingly I should make changes in HID descriptor which are - REPORT_COUNT = 64, REPORT_SIZE = 8. In the current situation, the below image demonstrates how many no. of bytes are sent/received in nrfConnect.

    If I make the changes for 64 bytes, do I need to take care of any header bytes getting added to the packet or can all 64 bytes be data bytes? I know for sure that the first byte to be sent from nrf to pc should be report ID.

    Also in the code, in which locations are the packet size actually being checked for input & output report?

    I would like maximum size possible for input & output report for Windows OS & Mac OS.

  • Where do you find REPORT_COUNT and REPORT_SIZE?

    bscdb said:
    Also in the code, in which locations are the packet size actually being checked for input & output report?

     I could find one place in the code where the report length is checked.

    if (len <= p_hids->p_inp_rep_init_array[rep_index].max_len)
    {
        memcpy(p_host_rep_data, p_data, len);
    }

    This is done in  the ble_hids_inp_rep_send() function. Not sure if this is what you're asking for.

  • Cool! You got my point. That is exactly what I was looking for. So similarly it is being checked in ble_hids_outp_rep_get() function? Actually, I am thinking from host application point of view which would be running on Windows, MAC, etc. Will the packet size affect the communication between host and ble device? Do you think if the host sends a packet of 64 bytes, nrf will be in a position to handle that size without any data loss?

    How do 

    uint8_t      rep_index
     & 
    uint16_t len
     relate to eachother? These are the arguments passed in ble_hids_inp_rep_send() function.

    Changes made

    (1) For input report
    0x75, 0x08, // REPORT_SIZE(8)
    0x95, 0x40, // REPORT_COUNT(64)
    (2) For output report
    0x75, 0x08, // REPORT_SIZE(8)
    0x95, 0x02, // REPORT_COUNT(2)
    (3) err_code = ble_hids_inp_rep_send(&m_hids, 0, 64, (unsigned char*)&arr_data, m_conn_handle);


  • I'm using SDK15.2. Similarly for output report I noticed that nrfConnect can only send a byte to nrf device. Can more bytes be sent? If yes, then after changing the descriptor where else do I make the necessary changes?

    Also is the IN/OUT endpoint configured to send/receive data on receiving an IN/OUT token packet?

    What can be the maximum input/output buffer size?

  • What API are you using for developing the host application, specifically the HID portion?

Reply Children
Related