Thanks - this is reminding me of IBM 4341 mainframe assembler - that made my head hurt as well.
Yup. You’re in the right mindset now
This is probably the best answer once you deal with the hardware purchase. - “The Kodi implementation of CEC isn’t too bad - doesn’t do everything but depends on the special/corner cases you are trying to solve.”
I probably paint a more pessimistic picture than the normal use case. But I was trying to do all that crazy