I am presuming you can currently use the debug print of...
draw_txt_string(20, 10, osd_buf, conf.osd_color);
If not then get that working and you will have best luck.
====
What I did was comment everything out of the my_kbd_read_keys function. The only thing I kept was the top portion that debugs the new and old keys (see below). This way you can write down what changes when you press and hold a certain key. It also makes certain you don't crash by writing to memory with incorrect values....
Once you have all your keys mapped you can construct the KEYS_MASKx by ORing all your keys together. You determine which "mask#" by which variable changes when you press a key.
You must also know that kbd_fetch_data() works. If not you need to find the correct memory to inspect for the keyboard info.
As for CAM_ADJUSTABLE_ALT_BUTTON - Note: in the SD780 case I remapped the DISP key to be a PRINT key. You don't define an alternate ALT key unless you have additional keys that you want to be equal to the ALT key. Its a bit confusing. The CAM_ADJ... only defines an alternate ALT not what the ALT key is (its PRINT) but what is an ALT key in addition to the PRINT.
Clearer? If not I'll try again.
Harpo
----
#define KEYS_MASK0 (0x0000000F)
#define KEYS_MASK1 (0x00094800)
#define KEYS_MASK2 (0x00007041)
void my_kbd_read_keys()
{
static char osd_buf[64];
volatile long *mmio2 = (void*)0xE240; //VERIFY_SD780 - Should be set with DEFINE or something.
int isHeldDisp = 0;
kbd_prev_state[0] = kbd_new_state[0];
kbd_prev_state[1] = kbd_new_state[1];
kbd_prev_state[2] = kbd_new_state[2];
kbd_fetch_data(kbd_new_state);
sprintf(osd_buf, "1: %8x --> %8x", physw_status[0],kbd_new_state[0]);
draw_txt_string(20, 10, osd_buf, conf.osd_color);
sprintf(osd_buf, "2: %8x --> %8x", physw_status[1],kbd_new_state[1]);
draw_txt_string(20, 11, osd_buf, conf.osd_color);
sprintf(osd_buf, "3: %8x --> %8x", physw_status[2],kbd_new_state[2]);
draw_txt_string(20, 12, osd_buf, conf.osd_color);
msleep(500);
}
static KeyMap keymap[] = {
/* tiny bug: key order matters. see kbd_get_pressed_key()
* for example
*/
//SD780 - Keymap
{ 0, KEY_UP , 0x00000008 },
{ 0, KEY_DOWN , 0x00000004 },
{ 0, KEY_LEFT , 0x00000001 },
{ 0, KEY_RIGHT , 0x00000002 },
{ 1, KEY_SET , 0x00004000 },
{ 1, KEY_PLAY , 0x00080000 },
{ 1, KEY_MENU , 0x00000800 },
{ 1, KEY_POWER , 0x00010000 },
//xxxf --> xxxd when in movie mode by switch
//xxxxxxx4 --> xxxxxxx5 when in lens extended recording mode
{ 2, KEY_SHOOT_FULL , 0x00001001 },
{ 2, KEY_SHOOT_HALF , 0x00000001 },
{ 2, KEY_ZOOM_IN , 0x00004000 },
{ 2, KEY_ZOOM_OUT , 0x00002000 },
{ 2, KEY_PRINT , 0x00000040 }, //doesn't exist
{ 2, KEY_DISPLAY , 0x00000040 }, //swapped for print atm
//We will see if I can make KEY_DISPLAY a long KEY_DISPLAY...
{ 0, 0, 0 }
};
void kbd_fetch_data(long *dst)
{
//SD780 0xFF8431EC GetKbdState
volatile long *mmio0 = (void*)0xc0220200;
volatile long *mmio1 = (void*)0xc0220204;
volatile long *mmio2 = (void*)0xc0220208;
dst[0] = *mmio0;
dst[1] = *mmio1;
dst[2] = *mmio2 & 0xffff;
}