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

Need help regarding custom HID descriptor for nRF51822

Hi,

I am trying to modify the ble_hids_mouse example project to convert the device into a vendor defined HID device. I need to send 64 bytes of custom sensor data (which I am reading over SPI on nRF51) over custom HID so that my application on the PC can access the data using HID APIs. I have tried multiple HID descriptors but fail to get data on the PC side. I am using the HIDAPI library on a Windows 10 platform to read data from the HID device. The hid_open() function returns a valid handle for the HID device (VID,PID) but hid_read() always returns 0 bytes. Error code from ble_hids_inp_rep_send() function on nRF returns 0 (NRF_SUCCESS), so I am assuming there are no errors in sending HID input reports. 

Following are 2 HID descriptors which do not work:

(I)
0x05, 0x01, // Usage Page (Generic Desktop Page)
0x09, 0x00, // Usage (Undefined)
0xA1, 0x01, // Collection (Application)
0x09, 0x00, // Usage (Undefined)
0x16, 0x00, 0x00, // Logical Minimum (0)
0x26, 0xFF, 0x00, // Logical Maximum (255)
0x36, 0x00, 0x00, // Physical Minimum (0)
0x46, 0xFF, 0x00, // Physical Maximum (255)
0x66, 0x00, 0x00, // Unit (None)
0x75, 0x08, // Report Size (8)
0x95, 0x40, // Report Count (64)
0x81, 0x02, // Input
0xC0, // End Collection

(II)

0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x40, // REPORT_COUNT (64)
0x09, 0x01, // USAGE (Vendor Usage 1)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0x09, 0x01, // USAGE (Vendor Usage 1)
0x91, 0x00, // OUTPUT (Data,Ary,Abs)
0xc0 // END_COLLECTION

I have adjusted the input report length to 64 bytes at multiple places in the code and modified the report id as per the descriptors. 

However, reducing the length of the input report from 64 bytes to 8 bytes seems to work and I am able to receive 8 bytes of data in my application.

Can you please help to debug this issue.

Regards,

Mustafa 

Related