Programmatically Controlling Backlight Brightness - Windows Mobile Development and Hacking General

I am trying to write a Today screen item that will allow a user to quickly change the backlight dimmer level (i.e. hit a button go to x% hit another button go to y%). I have been able to find plenty of information regarding device power states and turning on and off the backlight, but nothing what so ever on how to control the current dimmer level.
Could somebody point me in the right direction? Specifically I am hoping to find a low-level API function that I can easily hook into (which is what I would expect) and also related registry keys (which I assume are what's being used by the backlight control panel).
Thanks in advance!

Look for MVBklight, it's a backlight app, really great with today plugin, pop up dimmer and cycling functions. Hope it helps you to do your own stuff.

Thanks for the above link. I think I may have actually found an english version, but I still haven't given up programming my own today item (especially since I want to learn the ins and outs of Today Screen items in general).
I think I've narrowed it down to the following
// Get a handle to the LCD device.
hLCD = CreateFile(TEXT("\\.\LCD"), blah, blah);
// Get the display brightness
DeviceIoControl(hLCD, IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS, blah, blah);
The problem I am having now is that when I specify the above device (\\.\LCD) I get a file not found error. I have a feeling that the device name may actually be different (even though this was an example given on MSDN it was for a laptop LCD i believe). How do I know that this is the proper name for the device? Is there a way to enumerate device names? Do I have to create a link for a device name to a device?
Thanks again.

Related

how to turn off keyboard backlight / IE WM5 tweaks, please

Hi,
I've got an orange SPV M3000, i find the blue keyboard backlight blurred
and confusing unless in complete dark environment.
the backlighting is useless in daylight, and i loose a lot of time identifing
the letters, not mentioning battery use
is there a registry entry that could permanently turn off the backlight
or is it hardware, each press turning on power?
_
in pocket internet explorer WM5, the navigation is already excellent
but i would need a few registry tweaks to make it 100% efficient:
1\ in full screen, we can use the volume slider to scroll between links
but how about using the other hardware buttons to click,
back, fullscreen on/off, home, stop, etc...
2\ add entries in the menus like:
direct favorites entries, full screen on/off etc...in regular screen.
also add more entries in full screen mode menu
3\change the color of links; blue by default
4\ have a "underline links:never" option like in regular IE
5\ open a link in a new window!
well any advice welcome on those
thanks
Funny, most people want to keep that backlight on longer - without success
But the information from that is the same - I don't think anybody has identified where the slide-out keyboard backlight gets its information. I couldn't find anything with CeRegSpy, so it might be hardcoded in the driver - or I'm not looking hard enough.
So the only option I'm aware of, currently, is voiding warranty, opening the thing up, and physically disabling the backlight :> I cannot recommend that option
I'm one of those who want the kb backlight on longer hope someone digs out the controls for this soon.

New: Quick access to backlight brightness

Hi folks,
When I'm using my PDA at night, I turn the backlight right down, so it doesn't wake the girlfriend (and blind me!) This requires many steps: Start->Settings->System->Backlight->Brightness->Grab stylus->Drag on screen.
I've written a simple little util which pops up a backlight brighness trackbar, plus 2 buttons to instantly minimize/maximize. You can download it from here. There's no installer - just drag the exe to your device, then create a shortcut to your Start Menu / Programs folder. Only tested on my Universal under WM6 - should work on any HTC (non-phone) device AFAIK.
Personally, I've attached it to the backlight button on the front of the universal, so to minimize backlight brightness I just tap that button, then tap the left softkey button.
Hopefully some of you find this useful - if so, lemme know! If you have any problems with it, I'll try to sort them out.
I've also made the source code available. It's a little C# class. Feel free to use it for whatever you want.
Hi,
I was looking something like that. But when I tested at my PPC, HP 6815, it did not work? Could you please help me ?
Regards,
Great work, jp_howard!
Very useful. I'm sure it may also run on many other mobile devices.
Will have a closer look at the sources
Thanks for this nice tool!
scholbert
hi jp_howard,
pls allow me a couple things:
1. it does not work while my o2 atom is cradled. maybe it will work if on battery power. let me test later, once i disconnect then get back here to update.
2. would it be possible to map it to the volume keys? this is useful for me because one of the major problems of o2 atom is the battery life, so i am force to always set the backlight its minimal setting to converse power. the problem is when i'm outdoor, i would not see the screen anymore due to the low brightness i mentioned, so it would be great if i could access the brightness level by the use of only the volume keys. anyway, i don't change the volume that often during calls...
3. lastly, i would also like to start programming in c# like what you did here. would it be too much too ask, if you point me in the right direction, so i could start programming too? btw, i'm basically a web developer, with formal training in c# windows programming as well, but not very well verse with CE programming. i've tried the hello world in vs2005 already but i'm still far from mobile programming. thanks.

Pedometer using Diamond's built in Accelerometer

=========================================
3/14/2009 Pedometer 1.42 is released.
What's new:
--Fixed "InvalidCastException" error for non-english regional setting.
NOTE:
1) If you want to keep your old jogging data, and customized sound file and background file, you need to save the "pedometer.sdf", "background.jpg", and "StepSound.wav" files, install the new version, then copy back these files to \program files\elitemway\pedometer folder.
2) !!! The pedometer is designed to count relatively accurately when you carry the phone vertically or horizontally around you left or right side of your waist belt. It may give you wrong result if carry your phone otherwise. Step detection algorithm that can handle all carrying position and walking/running conditions is very complicated and is beyond my knowledge. Step length and Calories conversion are unique for each individual and walking condition. There is no way that this can be very accurate. You may adjust these values in the "Setting" screen. The application is not globalized yet. Like all other xda developers, I have to find spare time working on this project. Thank you for your understanding!
==================================================
3/12/2009 Pedometer 1.41 patch is released.
What's new:
--Fixed the version number.
--When you set the distance unit to "mile", it still displays the distance value as km. This bug is fixed in the patch.
Copy the attached zipped exe to elitemway\pedometer folder, override the existing one.
12/25/2008 Pedometer 1.4 is released. Merry Christmas and Happy New Year!
What's new:
--The pedometer should also work when carrying in horizontal position. Please report if the counting is accurate enough.
--Added "Show toolbar" setting so that you can choose whether to show the toolbar on the main screen.
12/16/2008 Pedometer 1.3 is released.
What's new:
--Added battery threshhold setting. The program will pause pedometer, automatically save the current progress and then allow device to go into standby mode based on the Power setting when battery level falls below a certain value.
--Relocate the buttons from the main screen to menu.
--Display battery status on the main screen.
--You can change the background by replacing the default "Background.jpg" file.
12/15/2008 Pedometer 1.2 is released.
What's new:
--Step detection is a little bit better. It still has a lot of room for improvement though.
--While Pedometer is running, the screen will dim, but will not standby.
--The "Hide" button not only turns off the screen, it can also prevent the device from going into stanby mode. So you can let it run in the background for a long time. If you want to keep it running, do not use the Power button, instead using the Hide button.
--Pause button stops both time and step count. It will also stop the timer. So when it is paused, the device can be in the standby mode to save battery.
--I let it run around 7 hrs in office environment with fully charged batterry (1350mAh), with Blackberry connect and a few emails, no step sound, I still had about 45% left at the end.
--You can mute the step sound from the main screen.
--Now it has the HTC Diamond black transparent background. See the screenshot.
--The default step sound is shorter and "big foot" like. You can customize the sound by replace the default "StepSound.wav" file (do not use anything above 0.2 sec). Nero 8 wave editor and other tool is good for sound editing.
--Added error handling for possible decimal conversion error due to different regional setting. As a workaround, you can probably change you regional setting to English, then run the application, finish the setting, then change it back.
12/13/2008 Pedometer Release 1.0 summary
I searched extensively for a pedometer application that works on Diamond, but could not find anything. So I created one.
--It uses HTC Touch Diamond's built in Accelerometer.
--Only .Net CF 2.0 is required (comes with Diamond).
--You can pause and reset the step counter.
--It displays steps, distance, calories and time duration.
--You can use the Hide button to save battery.
--You can set the step length and calories per mile value.
--You can save, delete and view the historical data.
--The historical data is stored in Microsoft SQLCe compact database.
--It can play the sound when the step is detected.
--It can sound an alarm when the set distance is reached.
--Briefly tested with the US unlocked version of the Diamond and Sprint version of the Diamond.
--The sensor.dll is from http://www.koushikdutta.com/search/label/Sensor%20API
Tips:
--First, verify and set your preferred setting from the menu item.
--Find the best carrying position with the "Play step sound" option on.
--Use the Hide button to save battery.
--You can install on storage card, but it can break the application if you use the storage mode while the Pedometer application is running.
Known Issues:
--Step detection is not accurate sometime. The algorithm needs improvement.
--Hide mode does not prevent from going into sleep mode.
--After changing the setting, you need to close then reopen the application for teh new setting to take effect.
--It only works if the diamond is in the vertical position.
nice work buddy
Looks promising, thanks for the work!
any chance this would work on a touch pro? Also, if i wanted to leave it on all day just to basically see how many steps i'm getting in on a typical day, does that basically mean i'll have to recharge my phone everyday or is the battery footprint very low?
thanks!
this could be pretty useful. thanks
Nice work, I just came on here to look for one of these, thanks for the convenience haha
Thx for the ap, i was working on my one some time ago but stop after having bad etection when running, im going to test yours and given a feedback.
work well on Touch HD and Diamond but... i run for twenty steps but... it counted only nine.. (bouth diamond and touch HD was in vertical position)...
thank you
Step detection algorithm is hard to do. I will see if it can be improved.
fadywwf316 said:
any chance this would work on a touch pro? Also, if i wanted to leave it on all day just to basically see how many steps i'm getting in on a typical day, does that basically mean i'll have to recharge my phone everyday or is the battery footprint very low?
thanks!
Click to expand...
Click to collapse
Not sure if it will work on TouchPro. It should work though. This utility is still in early development stage. I do not have battery consumption data yet. The key is to find a reliable step detection algorithm. Thanks.
On my Touch Pro, RomeOS 1.51 :
When I try to run this APP.
Conversion from string "0.235" to type "Decimal" is not valid.
try changing your language options, there where any option to change the symbol of , to . or what else
Pedometer version 1.2 is released
Hi, All:
After some intensive efforts, the Pedometer version 1.2 is released. The HTC touch black transparent looks much better. Please post all questions in this thread.
I found this doc. It may be of interest to you in regards to your algorithm? Excellent work in any case.
http://www.embeddeddesignindia.co.in/STATIC/PDF/200810/EDIOL_2008OCT17_CORE_ETEST_AN_01.pdf?SOURCES=DOWNLOAD
Great App
thanks for great app. What would be really cool is if it would have its own TFlo3D tab.
doey_28 said:
I found this doc. It may be of interest to you in regards to your algorithm? Excellent work in any case.
http://www.embeddeddesignindia.co.i...08OCT17_CORE_ETEST_AN_01.pdf?SOURCES=DOWNLOAD
Click to expand...
Click to collapse
I will look at at the paper closely when I get a chance.
Is there a message/signal that is sent out when Windows Mobile is about to die due to lack of power? Because twice now, while hiking and while on the tread mill, my phone happened to be on it's last legs WRT power, unknown to me. In the middle of the workout/hike the phone died due to lack of power thus losing the progress so far. Could pedometer instead be notified of pending death of the phone due to power and "save itself"
before all power is gone?
Either that or how about a resume feature where ever minute (5 minutes or whatever) pedometer saves the current progress such that if the phone died for any reason and pedometer was restarted, it would sense that it was in the middle of a recording and offer to resume where it left off of start anew.
It seems to me that either solution would solve my problem.
defaria said:
Is there a message/signal that is sent out when Windows Mobile is about to die due to lack of power? Because twice now, while hiking and while on the tread mill, my phone happened to be on it's last legs WRT power, unknown to me. In the middle of the workout/hike the phone died due to lack of power thus losing the progress so far. Could pedometer instead be notified of pending death of the phone due to power and "save itself"
before all power is gone?
Either that or how about a resume feature where ever minute (5 minutes or whatever) pedometer saves the current progress such that if the phone died for any reason and pedometer was restarted, it would sense that it was in the middle of a recording and offer to resume where it left off of start anew.
It seems to me that either solution would solve my problem.
Click to expand...
Click to collapse
In next release, I can add battery alert threshold, play the sound, then, save the progress automatically and allow device to go to standby mode.
Lightsailpro, any plans to make this a GPS-assisted app? I realize that once you introduce GPS, you're taking away from the entire purpose of using the accelerometer to measure actual steps, however, I would love to have an app that I could choose on a given occasion whether it uses acc. to measure steps, or GPS to measure actual distance.
Currently, I run with my Diamond (for music) and a GPS watch (to track my progress and calories). How great it would be to ditch the watch and combine all the functionality into the Diamond!
lightsailpro said:
In next release, I can add battery alert threshold, play the sound, then, save the progress automatically and allow device to go to standby mode.
Click to expand...
Click to collapse
Sounds great! Thanks.
Now, it it's not too much to ask, a little better graphical design... I know, I'm no graphic artist either but I can steal with the best of them!

[APP] [25/3/09] [0.9 Beta] Cell Broadcast as Operator Name (Manila+Dialer)

Hey guys, my first real contribution here. I was using the Cell Broadcast solution with a today plugin posted here.
I had two major issues:
1. With Manila, can not use another today plugin
2. Need to use S2U2 because waking up of device, otherwise device stays on for sometime and screen touches are registered.
I played a bit with the registry and found out that setting two keys will reliably set a string which would be used for the operator name hence changing the string in Manila, dialer, etc.
I intercepted the messages coming from "Network" and extracted the CB body, if the device has been on for less than 5 seconds, then I assume that the cause of wake up was the CB, hence I suspend the device, its working quite nicely for now, will need your feedback for a probable general working release this weekend.
To do / Known Issues:
- FIXED: One key is hard coded as 41006 (my operator code), need to get it from phone. Otherwise ask user for it.
- Configurable from field, "Network*" is hard coded for now.
- Autostart using Init registry
- Hide / Remove UI
- For now UI shows incoming CB messages, power events, time difference between power on and message incoming for deciding to suspend or not.
Hello. I did search on this topic too. but did not find anything else that you do. but exactly what does not work. I got a newer version? thanks

[Q] Backlight setting help

I think this is a problem specific to the HD2 - basically, when i leave the phone on the auto backlight setting, it is too bright and therefore draining the battery. of course, setting it manually is a pain and it needs changing as conditions change etc.
What i am wonder is if there is any way of changing the auto so that it is consistently less bright? I have had a dig through the regedit but not really sure what i am looking for or doing!
I was guessing that there was a value that would be assigned to the brightness above the ambient brightness (from the light sensor) - can anyone enlighten me further?
Many thanks (and also for all those other posts i have used to help me make my phone exactly as i like it... CHT, BsB, Scilor etc!)
try Lumos.
nice. almost does too much! but good bit of software thus far. now to do some benchmarking... if only the sun would shine!
Controlling Backlight Settings
I took a different approach to resolve my problem -- keeping auto backlight turned off, but easily changing the backlight settings when I needed to change them. I created a shortcut called Backlight.lnk (that's a lowercase "L", not an "I" I discovered). I used a text editor and put in this line:
12#Powerexe.exe 2 - backlight tab
I saved it with the name Backlight.lnk and copied it to my Start/Programs folder using File Explorer. I moved the shortcut to the top of the Start menu where I can get to it quickly. I just tap Start and the shortcut icon and I am at the Backlight screen where I can quickly change the backlight level or the timeout settings. This saves a few taps compared with going in through the Settings screen.
I had tried Lumos and another program I found on the MS Marketplace, but both caused other problems for me.
PS: I found the line above in a posting at
http://forum.xda-developers.com/showthread.php?t=645916
It's an excellent tutorial on creating all kinds of shortcuts.
Try MVBKLight.
Very handy popup (plus a usefull torch).
I have both Auto and Manual controls. With links I immediately switch between sensor and the MVBKLight slider.
Try searching for autobacklight toggle. Basically, its an icon which when pressed on main screen enables disables autobacklight. So much better than lumos.

Categories

Resources