I have a ready hogp struct and I'm trying to subscribe to an input notification (I'm connecting to a bluetooth keyboard) and I'm getting error -22.
Here's the callback in question and the function that it's supposed to call after:
HOGP Ready callback:
static void hogp_ready(struct bt_hogp *hogp) { LOG_INF("The HOG profile has been created successfully. Now attempting to subscribe..."); struct bt_hogp_rep_info *rep = bt_hogp_rep_find(hogp, BT_HIDS_REPORT_TYPE_INPUT, 0); int err = bt_hogp_rep_subscribe(hogp, rep, hogp_read_cb); if (err) { LOG_INF("There was an error subscribing to the hogp read report: %d", err); }
read callback:
static uint8_t hogp_read_cb(struct bt_hogp *hogp, struct bt_hogp_rep_info *rep, uint8_t err, const uint8_t *data) { if (err) { LOG_ERR("Error in report notification: %d", err); return 0; } size_t size = bt_hogp_rep_size(rep); LOG_HEXDUMP_INF(data, size, "Received input report (keycodes):"); return 0; }
As far as I can tell, the problem is that I'm feeding the subscribe function something I shouldn't be, but everything seems correct after double-checking with the header.