Fix HotPlugManager destroying connected devices during transient USB resets#2365
Closed
cfuture81 wants to merge 2 commits into
Closed
Fix HotPlugManager destroying connected devices during transient USB resets#2365cfuture81 wants to merge 2 commits into
cfuture81 wants to merge 2 commits into
Conversation
added 2 commits
April 11, 2026 11:01
…tching base class LX200Telescope::Sync() behavior — prevents ~50s ALIGN_SYNCING stall in KStars/Ekos
…resets — prevents INDI client property cache invalidation when cameras (e.g. ZWO ASI) reset USB after frame readout
Contributor
|
I am unable to reproduce this issue locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some USB cameras (notably ZWO ASI) perform a USB bus reset after each frame readout as part of normal operation. The kernel reports this as a device disconnect/reconnect cycle (usb X-X.X.X: reset high-speed USB device), which triggers a udev event.
When the HotPlugManager's checkHotPlugEvents() runs during this brief window, discoverConnectedDeviceIdentifiers() (which calls ASIGetNumOfConnectedCameras()) does not see the camera on the bus. The manager treats this as a genuine disconnection and calls destroyDevice(), which:
On the next poll cycle (typically 1 second later), the camera reappears and createDevice() builds a fresh device instance with new property definitions. However, any INDI clients that were connected (KStars/Ekos, PHD2, etc.) still hold references to the old properties. Every subsequent property update from the driver hits "Could not find property" errors, effectively breaking all client communication with the camera.
This is particularly problematic when PHD2 is used as an external guider alongside Ekos, as PHD2 maintains its own INDI client connection. The property cache invalidation causes PHD2 to fail to complete exposures, leading to camera disconnection timeouts and guiding failure.
The fix adds a check in checkHotPlugEvents(): if a managed device is not found on USB but is currently connected to a client (isConnected() returns true), skip the removal. The device will be cleaned up naturally when the INDI connection fails on the next I/O operation (in the case of a true physical disconnection), or will continue operating normally (in the case of a transient USB reset).
This fix applies to all drivers using the HotPlugManager (ASI, SVBony, PlayerOne, etc.).