Power button doesn't work even if I don't use CHDK. So it must be "blocked" before chdk loads.
Probably, but not certain. CHDK is loaded before the camera visibly does anything, so it could be standard firmware behavior that happens after that point. We could confirm this with CHDK build that blinks in the bootloader, but there's probably no need.
So inside camera_init() I should replace print('Unpressing power button')
cli_cmd('=post_levent_to_ui"UnpressPowerButton"')
with print('Unpressing play button')
cli_cmd('=post_levent_to_ui"UnpressPBButton"')
Well, it's not clear you need it, but if you do that should be the correct syntax.
Also, I mentioned in the previous post that for most cameras CHDK would manipulate the state of the play button seen by the firmware when entering/leaving alt, but it turns out M3 doesn't.
Is the last line correct? Shouldn't be "UnpressPlayButton"? I am not currently at home, so I can't check. But where can I find syntax for this? Or appropriate library?
I believe PBButton should be correct for this. The levent name comes from strings in the firmware, you can iterate over them with
get_levent_def_by_index but I've attached a list for M3 here. The available events vary some by camera model, though most of the common ones are available.