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:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  User Interface and Voice
| | |-+  sansa clip+ : code modification to improve the lock feature
« previous next »
  • Print
Pages: [1]

Author Topic: sansa clip+ : code modification to improve the lock feature  (Read 5540 times)

Offline tata668

  • Member
  • *
  • Posts: 12
sansa clip+ : code modification to improve the lock feature
« on: May 01, 2011, 09:51:10 AM »
I've finally been able to compile my own version of Rockbox (for the Sansa clip+) in which I modified some key mapping. It is now almost perfect for my tastes, except for one thing: the lock feature. I'd really prefere a dedicated physical lock switch on the clip+!

Here's what I would like to be able to do, since there is no such dedicated lock switch:

1) When no buttons have been pressed for a while and the backlight turns off, I'd like the player to automatically locks itself.

2) I'd like the volume buttons to be usable when the player is locked. All other buttons would be locked, as they are currently.


Would that be hard to implement in the code? Is it possible?

Where should I look in the code, in which files?

Thanks for any hint!



Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: sansa clip+ : code modification to improve the lock feature
« Reply #1 on: May 01, 2011, 07:55:22 PM »
The problem with 1 is that the software lock only works in the WPS and radio screen IIRC. It shold be very simple to check if X time has passed without any buttons pressed in those screens and enable the lock. Doing it for all screens wouldnt be very easy though.

I'm pretty sure there is a patch on the tracker to do 2.
Logged


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

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 8963
Re: sansa clip+ : code modification to improve the lock feature
« Reply #2 on: May 01, 2011, 08:19:20 PM »
Quote from: JdGordon on May 01, 2011, 07:55:22 PM
The problem with 1 is that the software lock only works in the WPS and radio screen IIRC. It shold be very simple to check if X time has passed without any buttons pressed in those screens and enable the lock. Doing it for all screens wouldnt be very easy though.

You might be able to just make the backlight thread switch on the lock feature whenever the screen is off.  Of course that assumes you want it to lock at the same time the screen goes off.
Logged

Offline tata668

  • Member
  • *
  • Posts: 12
Re: sansa clip+ : code modification to improve the lock feature
« Reply #3 on: May 01, 2011, 10:03:33 PM »
I've been able to implement #2. My code may not be perfect but it works. If it can help someone:

in /apps/action.c, I replaced:

Code: [Select]
if (screen_has_lock && keys_locked)
by

Code: [Select]
if (screen_has_lock && keys_locked && !(button & BUTTON_VOL_UP) && !(button & BUTTON_VOL_DOWN))

And I will live without the #2 (lock on screen off) after all..

I instead added:

Code: [Select]
{ ACTION_STD_KEYLOCK,       BUTTON_HOME|BUTTON_REPEAT,      BUTTON_HOME },
and I commented:

Code: [Select]
/* { ACTION_WPS_QUICKSCREEN,   BUTTON_HOME|BUTTON_REPEAT,    BUTTON_HOME }, */
/* { ACTION_WPS_MENU,          BUTTON_HOME|BUTTON_REL,      BUTTON_HOME }, */

in /apps/keymaps/keymaps-clip.c

And added

Code: [Select]
action_wait_for_release();
after:

Code: [Select]
if (screen_has_lock && (ret == ACTION_STD_KEYLOCK))
    {

in /apps/action.c


With those modifs, I can now use the HOME button (long press) as a dedicated lock button while in WPS. I'm now happy!  :P


Thanks for the help!

And a big thanks to Rockbox developers!


« Last Edit: May 01, 2011, 10:06:40 PM by tata668 »
Logged

Offline HornetMaX

  • Member
  • *
  • Posts: 27
Re: sansa clip+ : code modification to improve the lock feature
« Reply #4 on: May 03, 2011, 12:42:06 PM »
Quote from: JdGordon on May 01, 2011, 07:55:22 PM
The problem with 1 is that the software lock only works in the WPS and radio screen IIRC.
Hmm I have no lock in FM screen with 3.8.1. Nothing even if I add a line like:
Code: [Select]
    { ACTION_STD_KEYLOCK,       BUTTON_HOME|BUTTON_REPEAT,      BUTTON_HOME },in the definition of button_context_radio in /apps/keymaps/keymaps-clip.c. Is this normal ?

Also, would be nice to have lock in REC screen too (kinda minor for me, but would make sense).

Quote from: tata668 on May 01, 2011, 10:03:33 PM
I instead added:

Code: [Select]
{ ACTION_STD_KEYLOCK,       BUTTON_HOME|BUTTON_REPEAT,      BUTTON_HOME },
and I commented:

Code: [Select]
/* { ACTION_WPS_QUICKSCREEN,   BUTTON_HOME|BUTTON_REPEAT,    BUTTON_HOME }, */
/* { ACTION_WPS_MENU,          BUTTON_HOME|BUTTON_REL,      BUTTON_HOME }, */

in /apps/keymaps/keymaps-clip.c
I checked and you actually don't need to comment out the 2nd line (ACTION_WPS_MENU), unless you really want to get rid of that. If you leave it, you'll have the lock for a press&hold of HOME and the WPS_MENU for a quick press of HOME.

MaX.
Logged

Offline tata668

  • Member
  • *
  • Posts: 12
Re: sansa clip+ : code modification to improve the lock feature
« Reply #5 on: May 03, 2011, 12:54:16 PM »
Quote from: HornetMaX on May 03, 2011, 12:42:06 PM

I checked and you actually don't need to comment out the 2nd line (ACTION_WPS_MENU), unless you really want to get rid of that. If you leave it, you'll have the lock for a press&hold of HOME and the WPS_MENU for a quick press of HOME.


Yes, I know. But being able to lock/unlock the player easily while it is in my pocket is really important for me. So I decided to dedicate the HOME button to that only, while in WPS.
Logged

Offline sockbox

  • Member
  • *
  • Posts: 111
Re: sansa clip+ : code modification to improve the lock feature
« Reply #6 on: May 09, 2011, 07:31:39 AM »
I couldnt unlock the keys using the edits above for single home button keylock. It would say 'Buttons Unlocked' and immediately go back to 'Buttons Locked'.

Quote
Hmm I have no lock in FM screen with 3.8.1. Nothing even if I add a line like:
Code:

    { ACTION_STD_KEYLOCK,       BUTTON_HOME|BUTTON_REPEAT,      BUTTON_HOME },

in the definition of button_context_radio in /apps/keymaps/keymaps-clip.c. Is this normal ?

You need to define that action in apps/radio/radio.c.
« Last Edit: May 09, 2011, 09:01:47 AM by sockbox »
Logged

Offline tata668

  • Member
  • *
  • Posts: 12
Re: sansa clip+ : code modification to improve the lock feature
« Reply #7 on: May 09, 2011, 06:32:08 PM »
Quote from: sockbox on May 09, 2011, 07:31:39 AM
I couldnt unlock the keys using the edits above for single home button keylock. It would say 'Buttons Unlocked' and immediately go back to 'Buttons Locked'.


Have you added the "action_wait_for_release();" part?
Logged

Offline sockbox

  • Member
  • *
  • Posts: 111
Re: sansa clip+ : code modification to improve the lock feature
« Reply #8 on: May 09, 2011, 06:40:03 PM »
Quote from: tata668 on May 09, 2011, 06:32:08 PM
Have you added the "action_wait_for_release();" part?

Yes.

I'm more interested in the FMS lockscreen though.
Logged

Offline HornetMaX

  • Member
  • *
  • Posts: 27
Re: sansa clip+ : code modification to improve the lock feature
« Reply #9 on: May 10, 2011, 05:17:58 PM »
Quote from: sockbox on May 09, 2011, 07:31:39 AM
I couldnt unlock the keys using the edits above for single home button keylock. It would say 'Buttons Unlocked' and immediately go back to 'Buttons Locked'.
Hmm, I managed to have the single-button lock exactly as described by Tata668.
Quote from: sockbox on May 09, 2011, 07:31:39 AM
Quote
Hmm I have no lock in FM screen with 3.8.1. Nothing even if I add a line like:
Code:

    { ACTION_STD_KEYLOCK,       BUTTON_HOME|BUTTON_REPEAT,      BUTTON_HOME },

in the definition of button_context_radio in /apps/keymaps/keymaps-clip.c. Is this normal ?

You need to define that action in apps/radio/radio.c.
Ouch, not sure my understanding of RB code is that good ...

MaX.
Logged

Offline sockbox

  • Member
  • *
  • Posts: 111
Re: sansa clip+ : code modification to improve the lock feature
« Reply #10 on: May 16, 2011, 04:54:22 PM »
I started working on an FM lock for the clip+. So far it only shows "Buttons Locked" when home + select are pressed then brings you back to the main menu. Buttons will not work until the 2nd key press.

fm_clip_lock.diff
http://www.mediafire.com/?xnt2tv90gc19jjo

I don't think I'm knowledgeable enough to actually get it working. But it's a start.
Logged

Offline sideral

  • Developer
  • Member
  • *
  • Posts: 48
Re: sansa clip+ : code modification to improve the lock feature
« Reply #11 on: May 20, 2011, 06:43:19 PM »
May I ask you to host patches in the tracker? Asking to download diffs from mediafire is a bit much...
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  User Interface and Voice
| | |-+  sansa clip+ : code modification to improve the lock feature
 

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

Page created in 0.153 seconds with 22 queries.