i tried to do a basic port but i'm stuck with kbd task..it doesn't seem to be responding "as usual" (i.e. no luck in getting to recognize keypresses, even if keymasks should be correct..) anyone else trying to hack this camera?
The keyboard logic looks to be different in the G12 (at least compared to the SX30 and S95 that I've compared to).
The logic I've previously used in my_kbd_read_keys is:
...
_GetKbdState(kbd_new_state); // get camera keyboard switch values (in camera keyboard part 1)
...
// CHDK keyboard logic (call kbd_process, and set physw_status)
...
_kbd_read_keys_r2(physw_status); // finish in camera keyboard processing
...
On the G12 the value stored in new_kbd_state[0] by GetKbdState appears to be random.
Also the value that is calculated and stored in physw_status[0] is overwritten at the start of kbd_read_keys_r2).
This has two effects:
1. kbd_process is looking at garbage and so is setting kbd_mod_state to incorrect values.
2. Even if kbd_process were working the value calculated for physw_status[0] is overwritten (and hence ignored) by kbd_read_keys_r2.
The following mod to my_kbd_read_keys will get the camera keyboard working and allow you to at least get into the ALT mode and menu:
...
_GetKbdState(kbd_new_state); // get camera keyboard switch values (in camera keyboard part 1)
_kbd_read_keys_r2(kbd_new_state); // finish in camera keyboard processing into CHDK variables
...
// CHDK keyboard logic (call kbd_process, and set physw_status)
...
The problem is that this may well break other CHDK functionality. I haven't had time to analyse what is going on in kbd_read_keys_r2 or kbd_process to understand the implications (kbd_process is an ugly mess and really needs an overhaul).
Perhaps someone with more knowledge of how these work can help.
Regards,
Phil.