Skip to content

enumerate_hotplug can yield devices twice #23

@SludgePhD

Description

@SludgePhD

If a device is plugged in immediately when enumeration is started (after it already connected to the HotplugMonitor), the device will be yielded by the read_dir enumeration, and then again due to the hotplug event.

This is not good, since it can lead to applications misbehaving when they process events from two instances of the same device. Luckily, it is also fairly rare, so might not be a problem in practice. If it does happen, a workaround is to simply unplug the device and plug it back in.

It isn't immediately obvious how a proper fix for this would look like. We cannot open the HotplugMonitor after we've already yielded all the read_dir devices, since that might miss some (which is worse than yielding a device twice).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions