Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add adapter auto detection for unspecified port #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kira-bruneau
Copy link
Contributor

With this PR, now if you leave off the port in the configuration, the first adapter will be selected automatically. Like in cec-client.

Based off the work @opeik started for #45 and closes #45.

}

let port = unsafe { adapters.assume_init() }[0].strComName;
if unsafe { libcec_open(connection.1, port.as_ptr(), open_timeout) == 0 } {
Copy link
Contributor Author

@kira-bruneau kira-bruneau Sep 12, 2024

Choose a reason for hiding this comment

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

I decided to call libcec_open in both branches of this match block to the avoid the overhead of converting strCommName to a CString.

@opeik
Copy link

opeik commented Sep 19, 2024

Oh sweet, good work!

Copy link
Owner

@ssalonen ssalonen left a comment

Choose a reason for hiding this comment

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

This looks good overall, nice & clean improvement! See a small comment on documentation

Thank you very much

src/lib.rs Show resolved Hide resolved
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.

Device autodetection
3 participants