Sorry for resurrecting this old thread, but it belongs to here.
Recently got one of these and was not pleased by the fact that it's missing a display button.
So I decided to use the power button instead. Only works in ALT mode, of course.
Patch against release 1.0
Index: platform/a470/kbd.c
===================================================================
--- platform/a470/kbd.c (revision 1614)
+++ platform/a470/kbd.c (working copy)
@@ -10,9 +10,9 @@
long canonkey;
} KeyMap;
-static long kbd_new_state[3];
-static long kbd_prev_state[3];
-static long kbd_mod_state[3];
+static long kbd_new_state[3] = {0xffffffff, 0xffffffff, 0xffffffff};
+static long kbd_prev_state[3] = {0xffffffff, 0xffffffff, 0xffffffff};
+static long kbd_mod_state[3] = {0xffffffff, 0xffffffff, 0xffffffff};
static KeyMap keymap[];
static long last_kbd_key = 0;
static int usb_power=0;
@@ -21,8 +21,9 @@
#define DELAY_TIMEOUT 10000
#define KEYS_MASK0 (0x00000000)
-#define KEYS_MASK1 (0x00000000)
+#define KEYS_MASK1 (0x4000000)
#define KEYS_MASK2 (0x153F)
+#define KEYS_INV1 (0x4000000)
#define NEW_SS (0x2000)
#define SD_READONLY_FLAG (0x20000)
@@ -161,6 +162,9 @@
static void __attribute__((noinline)) mykbd_task_proceed()
{
+ kbd_new_state[0] = physw_status[0];
+ kbd_new_state[1] = physw_status[1] ^ KEYS_INV1;
+ kbd_new_state[2] = physw_status[2];
while (physw_run){
_SleepTask(10);
@@ -231,19 +235,20 @@
_kbd_pwr_on();
kbd_fetch_data(kbd_new_state);
-
+ kbd_new_state[1] = kbd_new_state[1] ^ KEYS_INV1;
+
if (kbd_process() == 0){
// leave it alone...
physw_status[0] = kbd_new_state[0];
- physw_status[1] = kbd_new_state[1];
+ physw_status[1] = kbd_new_state[1] ^ KEYS_INV1;
physw_status[2] = kbd_new_state[2];
} else {
// override keys
physw_status[0] = (kbd_new_state[0] & (~KEYS_MASK0)) |
(kbd_mod_state[0] & KEYS_MASK0);
- physw_status[1] = (kbd_new_state[1] & (~KEYS_MASK1)) |
- (kbd_mod_state[1] & KEYS_MASK1);
+ physw_status[1] = ((kbd_new_state[1] & (~KEYS_MASK1)) |
+ (kbd_mod_state[1] & KEYS_MASK1)) ^ KEYS_INV1;
physw_status[2] = (kbd_new_state[2] & (~KEYS_MASK2)) |
(kbd_mod_state[2] & KEYS_MASK2);
@@ -432,6 +437,7 @@
/* tiny bug: key order matters. see kbd_get_pressed_key()
* for example
*/
+ /* additional key: ON/OFF: physw_status[1]: 0x4000000, inverted */
{ 2, KEY_UP , 0x00000001 }, //
{ 2, KEY_DOWN , 0x00000002 }, //
{ 2, KEY_LEFT , 0x00000008 }, //
@@ -442,6 +448,7 @@
{ 2, KEY_SHOOT_HALF , 0x00000010 },
{ 2, KEY_MENU , 0x00000400 },
{ 2, KEY_PRINT , 0x00001000 }, //
+ { 1, KEY_DISPLAY , 0x04000000 }, //on/off key, works only in ALT mode
{ 0, 0, 0 }
};
Not for official inclusion (IMHO). I think some users would find it disturbing not being able to switch the camera off in ALT mode.
edit: Forgot to mention that this only makes sense when operating the camera by hand. From a script, pressing the fake "display" button would turn the camera off.
Update: several bugs have been fixed for the A470
http://chdk.setepontos.com/index.php?topic=650.msg80692#msg80692