Two small patches to correct what I believe is an incorrect cut&paste of code from the IXUS120 kbd.c file to the IXUS220 and IXUS230.
The code in the IXU120 uses a counter variable (
altDownTimer) in the routine
my_kbd_read_keys() to time how long the DISP button is held down. This allows the DISP key on a CHDK equiped IXUS120 to have three functions :
- short press activates <ALT>
- medium press changes display mode (logos etc)
- long press changes display brightness
The code supplements the "short press / long press" logic implemented in core/kbd.c that lets a short press start <ALT> mode and a longer press give the original key functionality.
The IXUS120 code is copied almost exactly to the kbd.c files for the IXUS220 & IXUS230. According to the comments, the author(s) apparently believed its purpose was to provide the "short press/long press" logic that is actually handled by core/kbd.c. However, the code cannot provide that functionality (or the three state logic given to the IXUS120) because it is implemented to use the wrong physw_status entry - i.e. :
physw_status[0] &= ~alt_mode_key_mask; // press the VIDEO button
rather than
physw_status[2] &= ~alt_mode_key_mask; // press the VIDEO button
The patch file(s) delete the unnecessary logic and prevent the code from writing to the wrong physw_status register with possible unpredictable results.