Dear reader,
I am creating a HID over GATT peripheral, having a single HID input and output report in the report map. According to the USB HID specs 1.11 it is not required to have reportIDs in the report map and the reports that are going to be transmitted will not have the 1 byte reportID prefix. However, when I omit the reportIDs from the report map, I cannot send or read data from the peripheral using a HID host (Windows PC or Android phone). When looking at the Bluetooth stack it appears that in hogpd_create_db_req_handler() [@line 318 in hogpd_task.c] the reportID in the database is automatically incremented per report (report_ref.report_id++;). I noticed that when these reportIDs are not congruent with those in the report map, the communication between the peripheral and the host will not work. If they are congruent the communication will be successful.
How can I make the bluetooth stack work without reportIDs in the report map?
-----------------------------------
#define REPORT_MAP_LEN 28 //32
// Report Descriptor == Report Map (HID1_11.pdf section E.6)
const uint8 report_map[REPORT_MAP_LEN] =
{
0x06, 0xAB, 0xff, // USAGE_PAGE (Vendordefined 0xFFAB)
0x0A, 0x00, 0x02, // USAGE (Vendor-defined 0x0200)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x06, // REPORT_COUNT (6)
0x09, 0x01, // USAGE (Vendor Usage 1 0x0001)
//0x85, 0x01, // report ID=1
0x82, 0x02,0x01, // INPUT (data,variable, no wrap, linear, preferred state, no null, buffered bytes)
0x09, 0x02, // usage = Vendor usage 2
//0x85, 0x02, // report ID=2
0x92, 0x02,0x01, // OUTPUT (data,variable, no wrap, linear, preferred state, no null, non volatile, buffered bytes)
0xc0 // END_COLLECTION
}
void app_hogpd_create_db(void)
{
// Add HID Service in the database
struct hogpd_create_db_req *req = KE_MSG_ALLOC(HOGPD_CREATE_DB_REQ,
TASK_HOGPD,
TASK_APP,
hogpd_create_db_req);
// fill database
req->hids_nb = 1; // Number of HID Service instances to add in the database.
// Configuration for each HID Service you want to add
req->cfg[0].features.svc_features=0x00; //Features supported in the HID Service (A general HID device)
req->cfg[0].features.report_nb=2; // Value of the HID Information Characteristic.
// Features supported by each of the Report Characteristics in the HID Service
req->cfg[0].features.report_char_cfg[0]=HOGPD_CFG_REPORT_IN; // The Report is an input Report.
req->cfg[0].features.report_char_cfg[1]=HOGPD_CFG_REPORT_OUT; // The Report is an output Report.
//Value of the HID Information Characteristic
req->cfg[0].hid_info.bcdHID=0x111; //HID Class Specification release number in binarycoded decimal
req->cfg[0].hid_info.bCountryCode=0; // Hardware target country.
req->cfg[0].hid_info.flags=HIDS_NORM_CONNECTABLE; //Inform if the HID Device is normally connectable.
// Send the message
ke_msg_send(req);
}