So, I was wondering how the hell does canon know about keypresses. If it were me, I'd use an external interrupt driven by the TX chip and then run the appropriate handlers.
Does anyone know if it works like this?
Yes.
My theory:
- button presses originate from the MPU, via SIO3/MREQ: http://magiclantern.wikia.com/wiki/SIO3_MREQ
- 5Dc: bindGUISwitchCBR; on newer cameras it's more complicated, but along the same lines
- the bind function sends GUI events via GUI_Control (ML name: fake_simple_button).
In 5Dc, bindGUISwitchCBR is overriden to figure out which wheel was turned, because they both send the same GUI event (see gui.c).
However, I had no success porting this trick on 5D3 to figure out unhandled buttons that have all the same event code ( GUICMD_PRESS_BUTTON_SOMETHING ).
you can add a watchpoint to GUI_CONTROL function and look at the call trace if that helps
GUI_CONTROL processes the event in gui_main_task (Canon's button handler), and GUI_Control sends it to gui_main_task. Small difference, but kinda important.
Thanks for the info, I really hope I can manage to fix the damn button codes once and for all :P
You are talking about AV button, right?
That one is tricky, as the MPU sends something like OLC_INFO_CHANGED...
Not only the AV button, but also SET and other stuff.