mirror of
https://github.com/shadps4-emu/ext-libusb.git
synced 2026-01-31 00:55:21 +01:00
If no device ID is specified, and for instance a hub is plugged, many devices will be attached (and later detached) at the same time. The old code counting only 2 events would then exit prematurely. By counting attach and detach events separately, we preserve the old behaviour in the single-device case, but also allow more complex sequences to be handled in a way that mostly appears intuitive. This is not fool-proof, and we can still end up leaving after a surprise detachment of a "pre-existing" device while we have one of the "new" devices open. In this case print a warning. References #1455 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>