how to "safely" remap buttons

Started by dpjpandone, August 29, 2014, 05:35:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dpjpandone

I often use my 7D with a letus MCS camera cage which is great, but it's very difficult to press the trash button to access ML menus. I never use the raw/jpeg button on 7D, (I prefer to do file conversions on a computer instead...) and it's in a comfortable to reach place, so I decided to lie in the gui.h file and tell ML that raw/jpg is actually trash.

Does anyone see a problem with this? I get the desired result, but I'd really like to know the correct way to do this.

I found this thread, which was related, but not very helpful: http://www.magiclantern.fm/forum/index.php?topic=7816.msg70766#msg70766


a1ex

Since it's not really used anywhere else, it will work. If you don't want to lie, look in menu.c and change it to react on both buttons maybe.

An alternative way to open ML menu is a long press on the joystick. Does it help?

dpjpandone

That is very helpful,  thank you A1ex! I never knew about "long press joystick" guess I should rtfm.... I will also try in menu.c to get both working

dpjpandone

Here is a list of things that don't work (so you can see that I'm trying...)

#if defined CONFIG_7D
if (button_code == BGMT_PRESS_RAW_JPEG)
button_code = BGMT_TRASH;
#endif


and this:

#if defined CONFIG_7D
if (event->param == BGMT_PRESS_RAW_JPEG)
event->param = BGMT_TRASH;
#endif


menu.c is a really long file, I searched for "trash" and found stuff like what I tried above, but it doesn't work.

I don't really need this anymore, since I now know that I can enter menu with longpress joystick and exit with af-on, but it would be nice to understand it in case I want to remap another button sometime in the future.

dpjpandone

OK, somewhat related, I'm trying to fake a Q button on EOSM using the play button while ML menu is open. The reason is because there is currently no way to access submenus when an external monitor is attached.

here is what I tried:

#if defined(CONFIG_EOSM) // this is to allow play to act as Q on
{   
if (gui_state == GUISTATE_MENUDISP){
if (event->param == BGMT_PLAY){
fake_simple_button(BGMT_Q);
}
#endif


also tried this:

#if defined(CONFIG_EOSM) // this is to allow play to act as Q on
   
#if (gui_state == GUISTATE_MENUDISP && menu_shown)
if (event->param == BGMT_PLAY){
fake_simple_button(BGMT_Q);
#endif
#endif


but it does not work. It looks like it kind of wants to work, but it gets passed to canon... any hints?


anyone know where the code for this feature is? - FEATURE_SWAP_INFO_PLAY - I just opened and search almost every file in src folder, only found it in gui-common, but not what I was looking for...

dpjpandone

I finally found the code that makes play increment a value in the menu, (from menu.c):

    case BGMT_PLAY:
        if (menu_help_active) { menu_help_active = 0; /* menu_damage = 1; */ break; }
        menu_entry_select( menu, 1 ); // decrement
        menu_needs_full_redraw = 1;
        //~ menu_damage = 1;
        //~ menu_hidden_should_display_help = 0;
        break;


so, I'm pretty sure I need to do something like this:

    case BGMT_PLAY:
#if defined(!CONFIG_EOSM)         
if (menu_help_active) { menu_help_active = 0; /* menu_damage = 1; */ break; }
        menu_entry_select( menu, 1 ); // decrement
        menu_needs_full_redraw = 1;
        //~ menu_damage = 1;
        //~ menu_hidden_should_display_help = 0;
        break;
#else
menu_toggle_submenu();
break;
#endif


I know this isn't complete, (I have to add conditions like - if we're in ml menu and the entry has children etc...) but I wanted to see if I could make play act like Q all the time first, then add the other stuff when I have it working..

but this isn't working at all....

Any hints guys?