Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Notice: A non well formed numeric value encountered in /sites/ on line 96 Deprecated: Function create_function() is deprecated in /sites/ on line 104 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /sites/ on line 845 Deprecated: Function create_function() is deprecated in /sites/ on line 111 FS#8285 : "Flashlight" plugin



FS#8285 - "Flashlight" plugin

Attached to Project: Rockbox
Opened by William Thomas (p.opus) - Sunday, 09 December 2007, 06:41 GMT
Last edited by Peter D'Hoye (petur) - Wednesday, 23 April 2008, 21:16 GMT
Task Type Patches
Category Plugins
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


I used to use the brightness of my Sansa E200 display in original firmware as sort of a "flashlight" to illuminate my way around the house or any other need where I needed a little light. The display on the Sansa is by default rather bright, and can illuminate an entire room with the brightest settings.

With Rockbox, my favorite themes have a darker background and as such, the display is not usable as a "flashlight" anymore. I like the dark background/light letters for readability, but don't wish to change a theme, just to get more output from the screen light.

Perhaps a quick little plugin called flashlight could be added to plugins,
The "flashlight" would turn on whenever the application is selected. Rockbox would set maximum brightness on the LCD and provide a blank screen with a background color of FFFFFF regardless of the currently selected theme.

When the select or menu button is pushed, the plugin would simply go back to the Plugin selection screen with the original brightness and Theme.

If you wanted more features, such as a timer for the light, then you could simply add a configure screen that would allow you to perhaps set the max time of activation and customize the "color" of the light by using the color configurator much like the current background color configurator is written

It seems like it would be a pretty simple plugin, and I would use it quite a bit.

I just don't know how to code.

Any chance for a simple "flashlight" plugin? Any interest from others?
This task depends upon

Closed by  Peter D'Hoye (petur)
Wednesday, 23 April 2008, 21:16 GMT
Reason for closing:  Accepted
Comment by Jeton Aliji (jeton) - Sunday, 09 December 2007, 22:24 GMT
I like the idea.
i white blank screen at maximum brightness would be useful as a plugin.
Comment by x (vmh) - Monday, 10 December 2007, 16:30 GMT
Try this. I don't know if it really works, I haven't tried. I don't use it myself. It only tooks ~2-3 minutes to implement it. It turns on the blacklight, set the background to white. Press any button to quit. That's all.
Comment by William Thomas (p.opus) - Tuesday, 11 December 2007, 03:33 GMT
I can try it, but I'll need to learn how to apply patches to Rockbox.

As an alternative, if you run the RockPaint application, it opens with a white screen by default, so maybe the need for this isn't as great as originally thought.

However, I do still like the flashlight application idea.
Comment by Ali (shortarabguy) - Sunday, 23 December 2007, 14:12 GMT
I love the idea, I'm going to try using this patch if I can figure out how to implement it. Sorry, Vuong, but you're talking to a bunch of people who don't really know what we're doing, haha.

I'll update with information if I get it to work. If it does, I'd love to try changing it around to different colors. I play around with photography and would kill for something like this if it works out.
Comment by Jeton Aliji (jeton) - Saturday, 05 January 2008, 18:16 GMT
Another benefit of this would be the option to turn the scrollwheel on, as a lot of users turn it off. Therefore a white background (with maximum brightness) and a blue scrollwheel come in handy when there's no electricity (like in my country, 3 days without power).
Comment by Thomas Martitz (kugel.) - Monday, 04 February 2008, 16:17 GMT
Uploaded a new version, which changes (if possible) the brightness to the highest value to increase the flashlight'ablity even more :)
Comment by Robert Menes (RMenes379) - Monday, 04 February 2008, 16:19 GMT
This looks like a pretty useful plugin, especially if there's a blackout and you don't have a real flashlight handy. :)

Will try to compile it with one of my DAPs.
Comment by Thomas Martitz (kugel.) - Monday, 04 February 2008, 18:01 GMT
Ok, this one should actually work when one has a backdrop set. Also, I cleaned the code up a little and changed the header properly.

Tested on e200.
Comment by Alexander Papst (DerPapst) - Monday, 04 February 2008, 22:13 GMT
After some fun discussions in IRC and some boredom I've extended this plugin. Now it contains something to adjust the colour. There was kind of a request to be able to select a red light (night vision) so you can continue seeing things in the dark after using it (e.g. for viewing starmaps and such at night).

To change the colour on targets with a colour display use the left and right buttons (and the touch wheels, pads, scroll wheels where available). Any other button quits the plugin.

On targets without a colour display simply press/touch any button to quit the plugin.

Tested on iPod Video.

Note: The algorithm used to convert a hsv color to a rgb one probably can be optimized, because i didn't really used the value and saturation values. But i wasn't that bored ;-P
Comment by Alexander Papst (DerPapst) - Monday, 04 February 2008, 22:34 GMT
Oops... I broke the non colour targets.
Comment by David Maliniak (major_works) - Sunday, 17 February 2008, 01:40 GMT
The latest version yields the following for me:

$ patch --dry-run -p0 <flashlight_v5.patch
patching file apps/plugins/CATEGORIES
Hunk #1 succeeded at 96 (offset 1 line).
patching file apps/plugins/SOURCES
patching file apps/plugins/flashlight.c
patch: **** malformed patch at line 227:

Is that an "ignorable" error?
Comment by Thomas Martitz (kugel.) - Sunday, 17 February 2008, 01:48 GMT
No, malformed patches means that the diff contains wrong info. I.e. @@ +1,7 -1,7 @@ means that it deletes 7 lines of the original and writes 7 into it (6 of those don't differ). That's the header of each hunk. But, if the body wants to delete 8 lines and write 9 lines, the header and the body dismatch, resulting in a malformed patch.

I suggest you to read some tutorials about diff.
Comment by Thomas Martitz (kugel.) - Sunday, 17 February 2008, 01:49 GMT
Oh, yea, and malformed patch results in not applying cleanly (all hunks including and after the faulty line are not applied at all). So, it's definitely not ignorable.
Comment by Alexander Papst (DerPapst) - Wednesday, 09 April 2008, 21:14 GMT
Resync (r17055)
Comment by Alexander Papst (DerPapst) - Wednesday, 23 April 2008, 11:00 GMT
I forgot to svn add. Sorry :-P

Whoever considers to commit it: I haven't bumped the plugin api since it changes often and i don't want to sync this patch everytime something changes. So you'd have to do it before committing :-)