Stealing key presses - General Discussion and Assistance - CHDK Forum

Stealing key presses

  • 4 Replies
  • 120 Views
Stealing key presses
« on: 24 / January / 2020, 02:18:12 »
Advertisements
@reyalp


Hope you can help with my CHDK insight...again ;)


Over in Magic Lantern land I make use of the event handler, especially the key/button events.


This allows my Lua script to call my function to handle the key press, and critically, decide not to allow that key press to propagate through to the Canon side, ie I can decide to hyjack it.


I’ve looked in the basic CHDK scripting area, but, at the moment, I can’t seem to spot an equivalent functionality.


As I say, any insight would be gratefully received.


Cheers


Garry

Re: Stealing key presses
« Reply #1 on: 24 / January / 2020, 10:23:09 »
When CHDK is in <ALT> mode all key presses are blocked from reaching the Canon firmware.  CHDK scripts run in <ALT> mode.  You use the various script keyboard function to poll the buttons and take action as required.  If you want to have the Canon firmware react to a button press, you have to explicitly detect it in your code and call the press( ) or click( ) function for the key needed.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Stealing key presses
« Reply #2 on: 24 / January / 2020, 10:26:48 »
@waterwingz

Sorry, should have been clearer.
My script runs outside of Alt mode, ie always on in the background.
Are you saying I can only manage key events when in Alt mode?
Cheers
Garry

Re: Stealing key presses
« Reply #3 on: 24 / January / 2020, 10:44:40 »


My script runs outside of Alt mode, ie always on in the background. Are you saying I can only manage key events when in Alt mode?
I'll remind you here that running scripts outside of <ALT> mode is in "undefined" or "indeterminate" untested territory.

That being said, you are going to have a tough time managing any keyboard interactions in that mode. CHDK was not designed to do that so you are essentially in a race condition with the Canon firmware to detect and clear key presses. I do not know if fake key presses will work reliably either.

While I can conceive of ways to add script controlled functionality to support managing key events outside of <ALT>, I have no idea what side effects and glitches that might create.  Probably a dark black hole we don't want tio enter?


Ported :   A1200    SD940   G10    Powershot N    G16


Re: Stealing key presses
« Reply #4 on: 24 / January / 2020, 11:01:33 »
@waterwingz


Understood, sound advice and I won’t go there  ;)


BTW my G5X just arrived  :)


Looking forward to testing CHDK out on it, even if the 5X version is at alpha.


Cheers


Garry

 

Related Topics