-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Device autodetection #45
Comments
This lovely hack for pub fn open(mut self) -> CecConnectionResult<CecConnection> {
...
let mut devices: [libcec_sys::cec_adapter_descriptor; 10] = unsafe { std::mem::zeroed() };
let num_devices = unsafe {
libcec_sys::libcec_detect_adapters(
connection.1,
&mut devices as _,
10,
std::ptr::null(),
true as i32,
)
};
if num_devices < 0 {
panic!("no devices found")
}
if unsafe { libcec_open(connection.1, devices[0].strComName.as_ptr(), open_timeout) } == 0 {
return Err(CecConnectionResultError::AdapterOpenFailed);
}
...
} |
Rusty wrapper for detection has not been implemented, no. You can find it in the list of unimplemented functions here: Line 1282 in 2ada364
Currently port name needs to be supplied by the user. Pull requests and API design are most welcome :) |
I made it work, the timeline went:
Anyhow, my fork diverged substantially and I'm unsure how to upstream it. Links: |
It is sad to read how painful the windows developer experience is here. This reveals the current setup is not yet very polished/production grade even though the build and ci passes in github with windows. Similar CI/CD optimizations have been discussed/proposed in ssalonen/libcec-sys#45 although not sure if the person will follow it through This is first time I hear incompatibility with msvc, can you file ticket about it, please? How does it surface? I can see how this lead to deeper rabbit whole and introducing the bindgen as part of the build loop (as opposed to static runs of bindgen + python like now)... re upstreaming: indeed, sounds like this needs quite a bit of work to split into manageable and logical chunks |
I ended up using the precompiled binaries mentioned in that issue.
As far as I can tell, I:
In my experience, running |
Did this somehow generate build errors or runtime errors? What makes it really "incompatible"? As far as I can understand, both types are compatible with the enum values. Some enums are signed when the c type contains negative values. Re. Precompiled binaries Instead of 3rd party precompiled binaries, I would instead prefer to use the dll's distributed via the official installer. The approach details were discussed in the same issue |
It was build errors. From memory it was incompatible because u32 can't be losslessly cast to i32. |
Coming back to this...
I understand you might get build failures if you change the signatures... But what the very first build error is MSVC, before you changed any of the code? |
@ssalonen Hey, sorry for the delay. The first set of build error was with your code, untouched by me. If you make a dummy app that depends on |
Hi there,
Does this wrapper support autodetecting a Pulse Eight CEC Adapter? I'm fiddling with
libcec-sys
to hopefully make it work.The example
cec-client
autodetects devices if one is not specified.The text was updated successfully, but these errors were encountered: