Support and General Use > User Interface and Voice
sansa clip+ : code modification to improve the lock feature
tata668:
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!
JdGordon:
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.
saratoga:
--- 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.
--- End quote ---
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.
tata668:
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: ---if (screen_has_lock && keys_locked)
--- End code ---
by
--- Code: ---if (screen_has_lock && keys_locked && !(button & BUTTON_VOL_UP) && !(button & BUTTON_VOL_DOWN))
--- End code ---
And I will live without the #2 (lock on screen off) after all..
I instead added:
--- Code: ---{ ACTION_STD_KEYLOCK, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
--- End code ---
and I commented:
--- Code: ---/* { ACTION_WPS_QUICKSCREEN, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, */
/* { ACTION_WPS_MENU, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, */
--- End code ---
in /apps/keymaps/keymaps-clip.c
And added
--- Code: ---action_wait_for_release();
--- End code ---
after:
--- Code: ---if (screen_has_lock && (ret == ACTION_STD_KEYLOCK))
{
--- End code ---
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!
HornetMaX:
--- 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.
--- End 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 },
--- End code ---
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: ---{ ACTION_STD_KEYLOCK, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
--- End code ---
and I commented:
--- Code: ---/* { ACTION_WPS_QUICKSCREEN, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, */
/* { ACTION_WPS_MENU, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, */
--- End code ---
in /apps/keymaps/keymaps-clip.c
--- End quote ---
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.
Navigation
[0] Message Index
[#] Next page
Go to full version