Rockbox

Tasklist

FS#11975 - Apply "Backlight on first keypress" only for certain keys

Attached to Project: Rockbox
Opened by sideral (sideral) - Monday, 28 February 2011, 23:37 GMT
Last edited by sideral (sideral) - Saturday, 23 April 2011, 13:20 GMT
Task Type Patches
Category User Interface
Status New
Assigned To No-one
Operating System Sansa AMSv2
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

I didn't like that the "Backlight on first keypress" function ignores the first keypress no matter which key was pressed. For example, I want the volume keys to work normally even when the backlight is off (that is, they should turn on the backlight *and* change the volume).

This patch restricts "Backlight on first keypress" to certain buttons only. in other words, these buttons work normally only when the backlight is on; otherwise, they just turn on the backlight. As a proof of concept, it changes the Clip and Clip+ behavior to filter out only the Home key when the backlight is off, allowing the other keys to function normally.

It works by allowing button-target.h to define the buttons that are filtered by the "Backlight on first keypress" function. If left undefined, the function filters all buttons when the backlight is off, as in the status quo.

[EDIT: Clarified that there is no overlap with FS#9305 - Context sensitive backlight on key press]
This task depends upon

Comment by PurlingNayuki (yzflcyq) - Saturday, 12 March 2011, 03:57 GMT
Looks a great one. But does it only affect Sansas model?
Comment by sideral (sideral) - Thursday, 24 March 2011, 22:14 GMT
The patch enables the feature only for the Clips, but the change to button.c is platform-agnostic. To enable it for another platform, simply define a BUTTON_BACKLIGHT mask in its button-target.h similarly to the changes for the Clips.
Comment by Alexander Levin (fml2) - Friday, 22 April 2011, 22:28 GMT
This seems to be closely related to what's done in FS#9305. I think the approach there is more solid since it cosiders the context (which is only known in the app layer). Maybe the efforts and the features of the two patches could be combined?
Comment by PurlingNayuki (yzflcyq) - Saturday, 23 April 2011, 03:07 GMT
I define BUTTON_BACKLIGHT for OndaVX747 like this:
#define BUTTON_BACKLIGHT (BUTTON_VOL_DOWN || BUTTON_VOL_UP)

Compiled sucessfully, but it doesn't work. Backlight opens as usual when I press other buttons.
Comment by sideral (sideral) - Saturday, 23 April 2011, 13:15 GMT
fml2 and yzflcyq,

There may be a misunderstanding regarding the intention of this patch. Its goal is not to suppress turning on the backlight on certain key presses. Rather, the intention is to always turn on the backlight, but suppress certain keys from doing their regular function unless the backlight is already on – much like the existing “Backlight on first keypress” function, but only for certain keys. In effect, these keys can be used to turn on the backlight without changing any screen or setting.

fml2, FS#9305 appears to have a conflicting, opposite goal: allow certain keys to work without turning on the backlight. There currently is no implementation-wise overlap either, and it's not clear to me that there should be: FS#9305 needs to suppress the backlight for certain actions and thus needs to run before the backlight is turned on, whereas the present patch needs to suppress certain actions when the backlight originally was off, and thus has to run when determining whether or not to call the keypress handler.
Comment by PurlingNayuki (yzflcyq) - Monday, 25 April 2011, 11:20 GMT
FS#9305 seems is what I really mean to want. Thanks.
What I wonder is, why it isn't work as you said on my Onda?
Comment by sideral (sideral) - Monday, 25 April 2011, 11:37 GMT
yzflcyq writes:
> What I wonder is, why it isn't work as you said on my Onda?

First, this patch only works in conjunction with the “backlight on first keypress” function, which has to be enabled. Also, from your description it's not clear that this patch didn't work for you: You just said that the backlight turns on when you press any other button, which is the expected behavior.

With the BUTTON_BACKLIGHT definition you quoted and with “backlight on first keypress” enabled, the volume buttons do not actually change volume when the backlight is off, but only turn on the backlight.

Loading...