• Status New
  • Percent Complete
  • Task Type Patches
  • Category User Interface
  • Assigned To No-one
  • Operating System Sansa AMSv2
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by sideral - 2011-02-28
Last edited by sideral - 2011-04-23

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

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]

Looks a great one. But does it only affect Sansas model?

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.

fml2 commented on 2011-04-22 22:28

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?

I define BUTTON_BACKLIGHT for OndaVX747 like this:

Compiled sucessfully, but it doesn't work. Backlight opens as usual when I press other buttons.

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.

 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?

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.


Available keyboard shortcuts


Task Details

Task Editing