diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index 021db38..7ff1ede 100644
--- a/profiles/input/hog-lib.c
+++ b/profiles/input/hog-lib.c
error("bt_uhid_send: %s (%d)", strerror(-err), -err);
}
+static void report_notify_destroy(void *user_data)
+{
+ struct report *report = user_data;
+
+ DBG("");
+
+ report->notifyid = 0;
+}
+
static void report_ccc_written_cb(guint8 status, const guint8 *pdu,
guint16 plen, gpointer user_data)
{
report->notifyid = g_attrib_register(hog->attrib,
ATT_OP_HANDLE_NOTIFY,
report->value_handle,
- report_value_cb, report, NULL);
+ report_value_cb, report,
+ report_notify_destroy);
+ if (!report->notifyid) {
+ error("Unable to register report notification: handle 0x%04x",
+ report->value_handle);
+ goto remove;
+ }
DBG("Report characteristic descriptor written: notifications enabled");
r->notifyid = g_attrib_register(hog->attrib,
ATT_OP_HANDLE_NOTIFY,
r->value_handle,
- report_value_cb, r, NULL);
+ report_value_cb, r,
+ report_notify_destroy);
+ if (!r->notifyid)
+ error("Unable to register report notification: "
+ "handle 0x%04x", r->value_handle);
}
return true;
diff --git a/src/device.c b/src/device.c
index 995d39f..28b93eb 100644
--- a/src/device.c
+++ b/src/device.c
}
bt_gatt_client_set_debug(device->client, gatt_debug, NULL, NULL);
+ g_attrib_attach_client(device->attrib, device->client);
/*
* Notify notify existing service about the new connection so they can