diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index bd35830..e006add 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
hogdev);
}
+static void report_free(void *data)
+{
+ struct report *report = data;
+ struct hog_device *hogdev = report->hogdev;
+
+ if (hogdev->attrib)
+ g_attrib_unregister(hogdev->attrib, report->notifyid);
+
+ g_free(report->decl);
+ g_free(report);
+}
+
static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
{
struct hog_device *hogdev = user_data;
DBG("HoG connected");
+ if (!hogdev->uhid_created && hogdev->reports) {
+ DBG("HoG init failed previously, preparing for re-init");
+ g_slist_free_full(hogdev->reports, report_free);
+ hogdev->reports = NULL;
+ }
+
hogdev->attrib = g_attrib_ref(attrib);
if (hogdev->reports == NULL) {
return hogdev;
}
-static void report_free(void *data)
-{
- struct report *report = data;
- struct hog_device *hogdev = report->hogdev;
-
- if (hogdev->attrib)
- g_attrib_unregister(hogdev->attrib, report->notifyid);
-
- g_free(report->decl);
- g_free(report);
-}
-
static void hog_free_device(struct hog_device *hogdev)
{
btd_device_unref(hogdev->device);