Skip to content

Conversation

gen2thomas
Copy link

@gen2thomas gen2thomas commented Oct 6, 2025

In my project involving many different (gobot-) devices, I found it difficult to identify the cause of errors in the start-stop workflow (connect-disconnect-connect), e.g. "Operation already in progress" was returned from this driver. When adding a little bit more information it is more clear which line/action causes the error.

Additionally I replaced the "connectChan" by a channel for the error to be returned from the go-routine. This should prevent possible access conflicts to the err-variable, although it looks to me that the go-routine is not really needed at the moment and could be replaced by a synchronous code - but maybe I overlooked something. A good reason for the go-routine would be, e.g. the implementation of a connect-timeout.

@gen2thomas gen2thomas marked this pull request as ready for review October 6, 2025 16:45
@gen2thomas gen2thomas force-pushed the feature/improved_errors branch from e6f5f05 to c3cdc9d Compare October 6, 2025 17:09
changes := sig.Body[1].(map[string]dbus.Variant)
if connected, ok := changes["Connected"].Value().(bool); ok && connected {
close(connectChan)
errChan <- nil
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
errChan <- nil

most likely this can be removed, I'm not quite sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant