ssalonen / cec-rs

GNU General Public License v2.0
10 stars 8 forks source link

Fix `audio_get_status` result #48

Closed kira-bruneau closed 1 month ago

kira-bruneau commented 2 months ago

audio_get_status returns an audio status, and doesn't propagate the transmit result:

Also the status doesn't neatly fit into a Rust enum, so I removed the existing enum and added a wrapper struct.

image

Page 260 of High-Definition Multimedia Interface Specification 1.3a

ssalonen commented 2 months ago

Thanks!

Hmm the enum*.rs is autogenerated by https://github.com/ssalonen/libcec-sys/blob/master/scripts/run-bindgen/bindgen.sh

So somethings needs to be done there... need to have a bit closer look to comment something sensible

can you add simple tests to the conversion similar to other such functions in this lib?

kira-bruneau commented 2 months ago

Oh ok! I'll just add them back. I mainly just removed them because the new struct made those enums unnecessary.

I'll also keep using the constants from libcec_sys for the struct, because CEC_AUDIO_VOLUME_STATUS_UNKNOWN conflicts with CEC_AUDIO_VOLUME_STATUS_MASK. It'd be a bit confusing to useCecAudioStatus::MuteStatusMask to check when the status is unknown.

ssalonen commented 2 months ago

Yes I think it's ok to keep all enums as-is and having this usability-layer separately like you have done here with new struct

kira-bruneau commented 2 months ago

I refactored my changes a bit so this new struct can be used with https://github.com/ssalonen/cec-alsa-sync.