core: Suppress hotplug events during initial enumeration 50/290950/1 accepted/tizen_8.0_unified accepted/tizen_unified tizen tizen_8.0 accepted/tizen/8.0/unified/20231005.095128 accepted/tizen/unified/20230406.165731 tizen_8.0_m2_release
authorBenjamin Berg <bberg@redhat.com>
Tue, 1 Mar 2022 14:08:38 +0000 (15:08 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 5 Apr 2023 09:09:00 +0000 (11:09 +0200)
commit8f304ca356ab056246398c9fd415e72f1ef5cbe1
treeb0980945c29f28ad5d6678ac679728eaec16a77a
parent46cad7e87817cf3f40ada224c90df309feab9f7a
core: Suppress hotplug events during initial enumeration

The initial enumeration should not result in hotplug events to be fired.
This is just a convenience though, API users still need to be prepared
to be notified a second time for a device that was plugged in between
libusb_init and libusb_hotplug_register_callback.

This regressed with commit 6929b82 ("Fix segmentation fault in
libusb_init() if usbi_backend.init() fails"). This commit avoids the
mentioned segmentation fault by avoiding to clean up the hotplug code if
it was not yet initialised.

Fixes #1082
Closes #1090
References #989

[Cherrypick from mainline commit 0846456 ("core: Suppress hotplug events during initial enumeration")]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Idbae2c394ba01694f9e6006d8a52036f6c73da77
libusb/core.c
libusb/hotplug.c
libusb/version_nano.h