diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-05-12 18:01:03 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-05-12 18:04:20 -0700 |
commit | c7955b2099dc6be46e977229d852612c4817f78f (patch) | |
tree | ef7955ca759bb1c9799476de6c25b9199c1815e3 | |
parent | 7a4b67f9caa6bdc004c910f3a52108744a8cab74 (diff) | |
download | bluez-c7955b2099dc6be46e977229d852612c4817f78f.tar.gz |
hog-lib: Fix not reading report_map of instances
If there is multiple instances the gatt_db of the instances was not
initialized causing the report_map_attr to be NULL which prevents the
report_map to be read and uhid device to be created.
Fixes: https://github.com/bluez/bluez/issues/298
-rw-r--r-- | profiles/input/hog-lib.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index e69ea1ba4..4a9c60185 100644 --- a/profiles/input/hog-lib.c +++ b/profiles/input/hog-lib.c @@ -1518,6 +1518,7 @@ static void hog_attach_instance(struct bt_hog *hog, if (!instance) return; + instance->gatt_db = gatt_db_ref(hog->gatt_db); hog->instances = g_slist_append(hog->instances, bt_hog_ref(instance)); } @@ -1557,6 +1558,8 @@ struct bt_hog *bt_hog_new(int fd, const char *name, uint16_t vendor, if (!hog) return NULL; + hog->gatt_db = gatt_db_ref(db); + if (db) { bt_uuid_t uuid; @@ -1573,8 +1576,6 @@ struct bt_hog *bt_hog_new(int fd, const char *name, uint16_t vendor, hog->dis = bt_dis_new(db); bt_dis_set_notification(hog->dis, dis_notify, hog); } - - hog->gatt_db = gatt_db_ref(db); } return bt_hog_ref(hog); @@ -1675,7 +1676,8 @@ static void hog_attach_hog(struct bt_hog *hog, struct gatt_primary *primary) } instance = bt_hog_new(hog->uhid_fd, hog->name, hog->vendor, - hog->product, hog->version, NULL); + hog->product, hog->version, + hog->gatt_db); if (!instance) return; |