Author Topic: Button Interrupt?  (Read 4736 times)

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Button Interrupt?
« on: October 17, 2012, 10:08:23 PM »
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?
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12465
Re: Button Interrupt?
« Reply #1 on: October 17, 2012, 10:15:53 PM »
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 ).


g3gg0

  • Developer
  • Hero Member
  • *****
  • Posts: 3157
Re: Button Interrupt?
« Reply #2 on: October 17, 2012, 10:43:35 PM »
you can add a watchpoint to GUI_CONTROL function and look at the call trace if that helps
Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: paypal@g3gg0.de
ONLY donate for things we have done, not for things you expect!

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12465
Re: Button Interrupt?
« Reply #3 on: October 17, 2012, 10:54:24 PM »
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.

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: Button Interrupt?
« Reply #4 on: October 17, 2012, 11:24:38 PM »
Thanks for the info, I really hope I can manage to fix the damn button codes once and for all :P
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12465
Re: Button Interrupt?
« Reply #5 on: October 17, 2012, 11:25:29 PM »
You are talking about AV button, right?

That one is tricky, as the MPU sends something like OLC_INFO_CHANGED...

nanomad

  • Administrator
  • Hero Member
  • *****
  • Posts: 2918
  • All your websites are belong to us
Re: Button Interrupt?
« Reply #6 on: October 18, 2012, 12:25:21 AM »
Not only the AV button, but also SET and other stuff.
EOS 1100D | EOS 650 (No, I didn't forget the D) | Ye Olde Canon EF Lenses ('87): 50 f/1.8 - 28 f/2.8 - 70-210 f/4 | EF-S 18-55 f/3.5-5.6 | Metz 36 AF-5