Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  User Interface and Voice
| | |-+  Sansa Clip +: hold (key lock) function for recording screen
« previous next »
  • Print
Pages: [1]

Author Topic: Sansa Clip +: hold (key lock) function for recording screen  (Read 2573 times)

Offline adw

  • Member
  • *
  • Posts: 9
Sansa Clip +: hold (key lock) function for recording screen
« on: March 15, 2012, 11:25:46 AM »
I'm trying to add a "key lock" function for my Sansa Clip +. So far I have added:

apps/keymaps/keymap-clip.c

/** Recording Screen **/
static const struct button_mapping button_context_recscreen[]  = {
...
#ifndef HAS_BUTTON_HOLD /* Clip+ */
    { ACTION_STD_KEYLOCK,        BUTTON_HOME|BUTTON_SELECT,     BUTTON_NONE },
#endif /* HAS_BUTTON_HOLD */

...

apps/recorder/recording.c

...
static bool keys_locked = false;
...
        if (button == ACTION_STD_KEYLOCK)
        {
            if (keys_locked)
            {
                keys_locked = false;
                splash(HZ/2, str(LANG_KEYLOCK_OFF));
            }
            else
            {
                keys_locked = true;
                splash(HZ/2, str(LANG_KEYLOCK_ON));
            }
        }

        if (keys_locked)
        {
            splash(HZ/2, str(LANG_KEYLOCK_ON));
        }
        else
        {

            switch(button)
            ...
            } /*switch(button)*/
        } /*if(keys_locked)*/

This is doing the job for most keys, but the UP and DOWN keys that change the item during recording (Voulme / Gain / Filename) are not locked, and I can't figure out where these keys are handled. Can anyone give me a hint please?

Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: Sansa Clip +: hold (key lock) function for recording screen
« Reply #1 on: March 15, 2012, 07:35:05 PM »
above the code you're fiddling with will be a call to something like gui_synclist_do_button(), check the lock before entering that.
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline adw

  • Member
  • *
  • Posts: 9
Re: Sansa Clip +: hold (key lock) function for recording screen
« Reply #2 on: March 16, 2012, 08:11:24 AM »
Thank you, JdGordon, that was too obvious for me to see it...

I have also udated splash messages and screen blanking.

My complete changes are shown below. If anyone cares to make a patch out of it (with proper HAS_BUTTON_HOLD everywhere and support for all players), feel free to use my code as a starting point.


apps/keymaps/keymap-clip.c

/** Recording Screen **/
static const struct button_mapping button_context_recscreen[]  = {
...
Code: [Select]
#ifndef HAS_BUTTON_HOLD /* Clip+ */
    { ACTION_STD_KEYLOCK,        BUTTON_HOME|BUTTON_SELECT,     BUTTON_NONE },
#endif /* HAS_BUTTON_HOLD */
...

apps/recorder/recording.c

...
Code: [Select]
static bool keys_locked = false;...
Code: [Select]
        if (button == ACTION_STD_KEYLOCK)
        {
            if (keys_locked)
            {
                keys_locked = false;
                splash(HZ/2, str(LANG_KEYLOCK_OFF));
                screen_update = NB_SCREENS;
                update_list = true;
                send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
            }
            else
            {
                keys_locked = true;
                screen_update = 0;
                update_list = false;
                FOR_NB_SCREENS(i)
                {
                    screens[i].clear_display();
                }
                splash(HZ/2, str(LANG_KEYLOCK_ON));
                FOR_NB_SCREENS(i)
                {
                    screens[i].clear_display();
                }
                button_clear_queue();
            }
        }

        if (keys_locked)
        {
            if (button != BUTTON_NONE)
            {
                splash(HZ/2, str(LANG_KEYLOCK_ON));
                FOR_NB_SCREENS(i)
                {
                    screens[i].clear_display();
                }
            }
        }
        else
        {
           /* let list handle the button */
            gui_synclist_do_button(&lists, &button, LIST_WRAP_UNLESS_HELD);

            switch(button)
            ...
            } /*switch(button)*/
Code: [Select]
       } /*if(keys_locked)*/
« Last Edit: March 16, 2012, 01:13:29 PM by adw »
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  User Interface and Voice
| | |-+  Sansa Clip +: hold (key lock) function for recording screen
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.113 seconds with 21 queries.